Total Complexity | 7 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class ChainedResources implements ApiResourcesInterface |
||
10 | { |
||
11 | private $static = []; |
||
12 | |||
13 | private $chainedResources = []; |
||
14 | |||
15 | public function __construct(array $resources) |
||
16 | { |
||
17 | foreach ($resources as $resource) |
||
18 | { |
||
19 | if (gettype($resource) === 'string' && class_exists($resource)) { |
||
20 | $this->static[] = $resource; |
||
21 | continue; |
||
22 | } |
||
23 | if ($resource instanceof ApiResourcesInterface) { |
||
24 | $this->chainedResources[] = $resource; |
||
25 | continue; |
||
26 | } |
||
27 | throw new BadConfigurationException('I expect to get a list of classes or ApiResourcesInterface instances.'); |
||
28 | } |
||
29 | } |
||
30 | |||
31 | public function getApiResources(): array |
||
38 | } |
||
39 | } |
||
40 |