| Total Complexity | 8 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class StaticModel extends Model |
||
| 10 | { |
||
| 11 | public static $keyColumn = 'key'; |
||
| 12 | |||
| 13 | use ConsoleAwareTrait; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @return array |
||
| 17 | */ |
||
| 18 | public function getModelAttributes() { |
||
| 19 | return []; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return static[] |
||
| 24 | */ |
||
| 25 | public function allModels() |
||
| 26 | { |
||
| 27 | $models = []; |
||
| 28 | $data = $this->getModelAttributes(); |
||
| 29 | if (!empty($data)) { |
||
| 30 | foreach ($data as $attributes) { |
||
| 31 | $models[] = new static($attributes); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | return $models; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param $id |
||
| 39 | * @return static |
||
| 40 | */ |
||
| 41 | public static function getById($id) { |
||
| 47 | } |
||
| 48 | /** |
||
| 49 | * @param $key |
||
| 50 | * @return static |
||
| 51 | */ |
||
| 52 | public static function getByKey($key) { |
||
| 61 | } |