We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 6 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Coverage | 90.91% |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | final class Attribute extends AbstractRelated |
||
| 27 | { |
||
| 28 | 2 | public function __construct($reference, Validatable $validator = null, $mandatory = true) |
|
| 29 | { |
||
| 30 | 2 | if (!is_string($reference) || empty($reference)) { |
|
| 31 | throw new ComponentException('Invalid attribute/property name'); |
||
| 32 | } |
||
| 33 | |||
| 34 | 2 | parent::__construct($reference, $validator, $mandatory); |
|
| 35 | 2 | } |
|
| 36 | |||
| 37 | 5 | public function getReferenceValue($input) |
|
| 38 | { |
||
| 39 | 5 | $propertyMirror = new ReflectionProperty($input, $this->reference); |
|
| 40 | 5 | $propertyMirror->setAccessible(true); |
|
| 41 | |||
| 42 | 5 | return $propertyMirror->getValue($input); |
|
| 43 | } |
||
| 44 | |||
| 45 | 11 | public function hasReference($input) |
|
| 48 | } |
||
| 49 | } |
||
| 50 |