| Total Complexity | 8 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class DynamicObject implements CastsAttributes |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Cast the given value. |
||
| 13 | * |
||
| 14 | * @param Model $model |
||
| 15 | * @param string $key |
||
| 16 | * @param mixed $value |
||
| 17 | * @param array $attributes |
||
| 18 | * |
||
| 19 | * @return array |
||
| 20 | */ |
||
| 21 | public function get($model, $key, $value, $attributes) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Prepare the given value for storage. |
||
| 43 | * |
||
| 44 | * @param Model $model |
||
| 45 | * @param string $key |
||
| 46 | * @param array $value |
||
| 47 | * @param array $attributes |
||
| 48 | * |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | public function set($model, $key, $value, $attributes) |
||
| 67 | } |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: