| Total Complexity | 7 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class ObjectType implements Type |
||
| 13 | { |
||
| 14 | /** @var string|null */ |
||
| 15 | private $name; |
||
| 16 | |||
| 17 | public function __construct(?string $name) |
||
| 18 | { |
||
| 19 | $this->name = $name; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function describe() : string |
||
| 23 | { |
||
| 24 | if ($this->name === '') { |
||
| 25 | return 'object'; |
||
| 26 | } |
||
| 27 | |||
| 28 | return $this->name; |
||
|
|
|||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param mixed $value |
||
| 33 | */ |
||
| 34 | public function validate($value) : bool |
||
| 35 | { |
||
| 36 | return is_object($value) && ($this->name === null || $value instanceof $this->name); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function acceptsNull() : bool |
||
| 42 | } |
||
| 43 | } |
||
| 44 |