| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 9 | public static function fromValue(Name $name, $value): self |
|
| 26 | { |
||
| 27 | 9 | if (!is_string($value)) { |
|
| 28 | 1 | $self = new self($name); |
|
| 29 | 1 | $self->value = $value; |
|
| 30 | |||
| 31 | 1 | return $self; |
|
| 32 | } |
||
| 33 | |||
| 34 | 8 | $value = Str::of($value); |
|
| 35 | |||
| 36 | 8 | if ((string) $value->substring(0, 1) !== '$') { |
|
| 37 | 1 | $self = new self($name); |
|
| 38 | 1 | $self->value = (string) $value; |
|
| 39 | |||
| 40 | 1 | return $self; |
|
| 41 | } |
||
| 42 | |||
| 43 | 7 | $self = new self($name); |
|
| 44 | 7 | $self->reference = new Name((string) $value->substring(1)); |
|
| 45 | |||
| 46 | 7 | return $self; |
|
| 47 | } |
||
| 81 |