| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.0218 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 16 | 2 | public function getFieldAttribute() |
|
| 17 | { |
||
| 18 | 2 | $fields = $this->fieldsFromConfig(); |
|
| 19 | |||
| 20 | // TODO: a fieldgroup should be used here to filter / find by key |
||
| 21 | 2 | foreach ($fields as $field) { |
|
| 22 | 2 | if (is_callable($field)) { |
|
| 23 | $field = call_user_func($field); |
||
| 24 | } |
||
| 25 | |||
| 26 | 2 | if ($field->key != $this->key) { |
|
| 27 | 1 | continue; |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | return $field; |
|
| 31 | } |
||
| 32 | |||
| 33 | 1 | return $this->defaultField(); |
|
| 34 | } |
||
| 56 |