Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
container.php
1<?php
2
4
5use \Bitrix\Location\Exception\ErrorCodes;
6
7final class Container
8{
9 private $configValues = [];
10
11 public function __construct(array $configValues)
12 {
13 $this->configValues = $configValues;
14 }
15
16 public function get($id)
17 {
18 if(!$this->has($id))
19 {
20 throw new \LogicException(
21 "Sevice configuration container does not contain '{$id}' value",
22 ErrorCodes::SERVICE_CONFIG_VALUE_NOT_FOUND
23 );
24 }
25
26 return $this->configValues[$id];
27 }
28
29 public function has($id)
30 {
31 return array_key_exists($id, $this->configValues);
32 }
33}