Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Application
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 initialize
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 *
5 * @package Zmscalldisplay
6 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
7 *
8 */
9
10namespace BO\Zmscalldisplay;
11
12use BO\Slim\Helper\ModuleLoggerInitializer;
13use Psr\SimpleCache\CacheInterface;
14
15if (($token = getenv('ZMS_CONFIG_SECURE_TOKEN')) === false || $token === '') {
16    throw new \RuntimeException('ZMS_CONFIG_SECURE_TOKEN environment variable must be set');
17}
18
19define('ZMS_CONFIG_SECURE_TOKEN', getenv('ZMS_CONFIG_SECURE_TOKEN'));
20
21if (!defined('ZMS_CALLDISPLAY_TWIG_CACHE')) {
22    $value = getenv('ZMS_CALLDISPLAY_TWIG_CACHE');
23    define('ZMS_CALLDISPLAY_TWIG_CACHE', ($value === 'false') ? false : ($value ?: '/cache/'));
24}
25
26class Application extends \BO\Slim\Application
27{
28    /**
29     * Name of the application
30     */
31    const IDENTIFIER = 'zms';
32    const MODULE_NAME = 'zmscalldisplay';
33
34    public static ?CacheInterface $cache = null;
35
36    const DEBUG = false;
37    const TWIG_CACHE = ZMS_CALLDISPLAY_TWIG_CACHE;
38
39    /**
40     * language preferences
41     */
42    public static $locale = 'de';
43
44    /**
45     * Base path for static assets (_css, _js). Must match routing and js/settings.js.
46     */
47    public static $includeUrl = '/terminvereinbarung/calldisplay';
48
49    public static $supportedLanguages = array(
50        // Default language
51        'de' => array(
52            'name'    => 'Deutsch',
53            'locale'  => 'de_DE.utf-8',
54            'default' => true,
55        ),
56        'en' => array(
57            'name'    => 'English',
58            'locale'  => 'en_GB.utf-8',
59            'default' => false,
60        )
61    );
62
63    public static $now = '';
64
65    /*
66     * -----------------------------------------------------------------------
67     * ZMS API access
68     */
69
70    public static $http = null;
71
72    public static $http_curl_config = array();
73
74    const JSON_COMPRESS_LEVEL = 1;
75
76    /**
77     * HTTP url for api
78     */
79    const HTTP_BASE_URL = 'http://user:pass@host.tdl';
80    const SECURE_TOKEN = ZMS_CONFIG_SECURE_TOKEN;
81
82     /**
83     * signature key for url signature to save query paramter with hash
84     */
85    public static $urlSignatureSecret = ZMS_CONFIG_SECURE_TOKEN;
86
87    public static function initialize(): void
88    {
89        ModuleLoggerInitializer::configure('ZMS_CALLDISPLAY');
90        self::$cache = ModuleLoggerInitializer::tryInitializeCache();
91    }
92}
93
94Application::initialize();