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