| Total Complexity | 9 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | final class Reference implements Argument |
||
| 20 | { |
||
| 21 | private $name; |
||
| 22 | |||
| 23 | 15 | private function __construct(Name $name) |
|
| 24 | { |
||
| 25 | 15 | $this->name = $name; |
|
| 26 | 15 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * {@inheritdoc} |
||
| 30 | */ |
||
| 31 | 17 | public static function fromValue($value): Argument |
|
| 32 | { |
||
| 33 | 17 | if (!is_string($value)) { |
|
| 34 | 1 | throw new ValueNotSupported; |
|
| 35 | } |
||
| 36 | |||
| 37 | 16 | $value = Str::of($value); |
|
| 38 | |||
| 39 | 16 | if ((string) $value->substring(0, 1) !== '$') { |
|
| 40 | 1 | throw new ValueNotSupported((string) $value); |
|
| 41 | } |
||
| 42 | |||
| 43 | 15 | return new self(new Name( |
|
| 44 | 15 | (string) $value->substring(1) |
|
| 45 | )); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | */ |
||
| 51 | 8 | public function resolve( |
|
| 70 | } |
||
| 71 | } |
||
| 72 |