| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 12 | protected function getFieldValue(array $attr, $field) |
|
| 38 | { |
||
| 39 | 12 | $method = 'set' . ucwords($field); |
|
| 40 | |||
| 41 | 12 | if (method_exists($this, $method)) { |
|
| 42 | // If there is a setter for this field, use that |
||
| 43 | 12 | return $this->{$method}($attr[$field]); |
|
| 44 | } |
||
| 45 | |||
| 46 | // Otherwise just set the property |
||
| 47 | 12 | return (isset($attr[$field])) ? $attr[$field] : null; |
|
| 48 | } |
||
| 49 | |||
| 62 |