Total Complexity | 5 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Output extends Model |
||
8 | { |
||
9 | /** |
||
10 | * Global content array. |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $content = []; |
||
15 | |||
16 | /** |
||
17 | * Dynamically call the add method on the desired model. |
||
18 | * |
||
19 | * @param string $name |
||
20 | * @param array $resourceData |
||
21 | */ |
||
22 | public function __call($name, array $resourceData): void |
||
23 | { |
||
24 | $name = strtolower(substr($name, 3)); |
||
25 | |||
26 | if (in_array($name, ApiDataChecker::getDataTypes())) { |
||
27 | $className = __NAMESPACE__.'\\'.ucfirst($name); |
||
28 | $this->content[$name] = $className::getInstance()->add($resourceData[0]); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Output the formatted content array. |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function format() |
||
38 | { |
||
39 | $this->resetLists(); |
||
40 | |||
41 | return $this->content; |
||
42 | } |
||
43 | |||
44 | protected function resetLists() |
||
49 | } |
||
50 | } |
||
51 | } |
||
52 |