1 | <?php |
||
30 | class ExtensionConfiguration implements SingletonInterface |
||
31 | { |
||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $configuration; |
||
36 | |||
37 | /** |
||
38 | * ExtensionConfiguration constructor. |
||
39 | */ |
||
40 | 5 | public function __construct() |
|
44 | |||
45 | /** |
||
46 | * @return boolean |
||
47 | */ |
||
48 | 5 | public function isDebug() |
|
52 | |||
53 | /** |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getHosts() |
||
57 | { |
||
58 | $hosts = explode(',', $this->get('hosts')); |
||
59 | array_walk($hosts, function (&$value) { |
||
60 | if (false === strpos($value, 'https://') && false === strpos($value, 'http://')) { |
||
61 | $value = 'http://' . $value; |
||
62 | } |
||
63 | }); |
||
64 | return $hosts; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return integer |
||
69 | */ |
||
70 | public function getDefaultTimeout() |
||
71 | { |
||
72 | return (int)$this->get('default_timeout'); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return integer |
||
77 | */ |
||
78 | public function getBanTimeout() |
||
79 | { |
||
80 | return (int)$this->get('ban_timeout'); |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param string $key |
||
85 | * @return string |
||
86 | */ |
||
87 | 5 | private function get($key) |
|
91 | } |
||
92 |