Lines
0.00%
0 / 9
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Application | 0.00% | 0 / 2 | 0.00% | 0 / 1 | 2 | 0.00% | 0 / 1 | |||
| initialize | 0.00% | 0 / 2 | 0.00% | 0 / 1 | 2 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * | |
| 5 | * @package Zmscalldisplay | |
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 7 | * | |
| 8 | */ | |
| 9 | ||
| 10 | namespace BO\Zmscalldisplay; | |
| 11 | ||
| 12 | use BO\Slim\Helper\ModuleLoggerInitializer; | |
| 13 | use Psr\SimpleCache\CacheInterface; | |
| 14 | ||
| 15 | if (($token = getenv('ZMS_CONFIG_SECURE_TOKEN')) === false || $token === '') { | |
| 16 | throw new \RuntimeException('ZMS_CONFIG_SECURE_TOKEN environment variable must be set'); | |
| 17 | } | |
| 18 | ||
| 19 | define('ZMS_CONFIG_SECURE_TOKEN', $token); | |
| 20 | ||
| 21 | if (!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 | ||
| 26 | class Application extends \BO\Slim\Application | |
| 27 | { | |
| 28 | /** | |
| 29 | * Name of the application | |
| 30 | */ | |
| 31 | const string IDENTIFIER = 'zms'; | |
| 32 | const string MODULE_NAME = 'zmscalldisplay'; | |
| 33 | ||
| 34 | public static ?CacheInterface $cache = null; | |
| 35 | ||
| 36 | const bool 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 ?string $includeUrl = '/terminvereinbarung/calldisplay'; | |
| 48 | ||
| 49 | public static array $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 ?\DateTimeInterface $now = null; | |
| 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 int JSON_COMPRESS_LEVEL = 1; | |
| 75 | ||
| 76 | /** | |
| 77 | * HTTP url for api | |
| 78 | */ | |
| 79 | const string HTTP_BASE_URL = 'http://user:pass@host.tdl'; | |
| 80 | const string SECURE_TOKEN = ZMS_CONFIG_SECURE_TOKEN; | |
| 81 | ||
| 82 | /** | |
| 83 | * signature key for url signature to save query paramter with hash | |
| 84 | */ | |
| 85 | public static string $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 | ||
| 94 | Application::initialize(); |