| Total Complexity | 4 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | abstract class StaticModel extends Model |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @return array |
||
| 12 | */ |
||
| 13 | public abstract function modelsAttributes(); |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @return static[] |
||
| 17 | */ |
||
| 18 | public function models() { |
||
| 19 | $models = []; |
||
| 20 | foreach ($this->modelsAttributes() as $key => $attributes) { |
||
| 21 | $models[$key] = new static($attributes); |
||
| 22 | } |
||
| 23 | return $models; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $key |
||
| 28 | * @return static |
||
| 29 | */ |
||
| 30 | public function findByKey($key) { |
||
| 36 | } |
||
| 37 | |||
| 38 | } |