| Total Complexity | 12 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class ConfigHelper |
||
| 10 | { |
||
| 11 | protected $request; |
||
| 12 | protected $params; |
||
| 13 | protected $appConfig; |
||
| 14 | |||
| 15 | public static function get(Request $request, ParameterBagInterface $params): self |
||
| 16 | { |
||
| 17 | return new self($request, $params); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function __construct(Request $request, ParameterBagInterface $params) |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | public function isFirstApp(): bool |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getFirstHost() |
||
| 39 | { |
||
| 40 | return $this->params->get('pwc.apps')[array_key_first($this->params->get('pwc.apps'))]['hosts'][0]; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getHost(): string |
||
| 44 | { |
||
| 45 | foreach ($this->params->get('pwc.apps') as $app) { |
||
| 46 | if (in_array($this->request->getHost(), $app['hosts'])) { |
||
| 47 | return $app['hosts'][0]; |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | throw new Exception('Unconfigured host `'.$this->request->getHost().'`. See piedweb_cms.yaml'); |
||
| 52 | } |
||
| 53 | |||
| 54 | public function getBaseUrl(): string |
||
| 57 | } |
||
| 58 | |||
| 59 | public function getApp($key) |
||
| 62 | } |
||
| 63 | |||
| 64 | public function getDefaultTemplate() |
||
| 69 |