| Conditions | 7 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 27 | public function __construct($value, ?string $type = null) |
|
| 28 | { |
||
| 29 | if ( |
||
| 30 | 27 | null === $type |
|
| 31 | 27 | || ($type === self::TYPE_CALLABLE && is_callable($value)) |
|
| 32 | 27 | || ($type === self::TYPE_OBJECT && is_object($value)) |
|
| 33 | 27 | || gettype($value) === $type |
|
| 34 | ) { |
||
| 35 | 24 | $this->value = $value; |
|
| 36 | } else { |
||
| 37 | 3 | throw new InvalidArgumentException('Incorrect type for value.'); |
|
| 38 | } |
||
| 49 |