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 Zmsticketprinter
6 * @copyright BerlinOnline Stadtportal GmbH & Co. KG
7 *
8 */
9
10namespace BO\Zmsticketprinter;
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_TICKETPRINTER_TWIG_CACHE')) {
22    $value = getenv('ZMS_TICKETPRINTER_TWIG_CACHE');
23    define('ZMS_TICKETPRINTER_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
33    const MODULE_NAME = 'zmsticketprinter';
34
35    public static ?CacheInterface $cache = null;
36
37    public const DEBUG = false;
38    const TWIG_CACHE = ZMS_TICKETPRINTER_TWIG_CACHE;
39
40    /**
41     * language preferences
42     */
43    public static $locale = 'de';
44
45    /**
46     * Base path for static assets (_css, _js). Must match routing and js/settings.js.
47     */
48    public static $includeUrl = '/terminvereinbarung/ticketprinter';
49
50    public static $supportedLanguages = array(
51        // Default language
52        'de' => array(
53            'name' => 'Deutsch',
54            'locale' => 'de_DE.utf-8',
55            'default' => true,
56        ),
57        'en' => array(
58            'name' => 'English',
59            'locale' => 'en_GB.utf-8',
60            'default' => false,
61        )
62    );
63
64    public static $now = '';
65
66    /*
67     * -----------------------------------------------------------------------
68     * ZMS API access
69     */
70
71    public static $http = null;
72
73    public static $http_curl_config = array();
74
75    public const JSON_COMPRESS_LEVEL = 1;
76
77    /**
78     * HTTP url for api
79     */
80    public const HTTP_BASE_URL = 'http://user:pass@host.tdl';
81    public const SECURE_TOKEN = ZMS_CONFIG_SECURE_TOKEN;
82
83    public const CLIENTKEY = '';
84
85    public static function initialize(): void
86    {
87        ModuleLoggerInitializer::configure('ZMS_TICKETPRINTER');
88        self::$cache = ModuleLoggerInitializer::tryInitializeCache();
89    }
90}
91
92Application::initialize();