Total Complexity | 6 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | abstract class ResourceValue extends AbstractValue implements ResourceValueInterface |
||
19 | { |
||
20 | /** |
||
21 | * ResourceValue constructor. |
||
22 | * |
||
23 | * @param mixed $value |
||
24 | */ |
||
25 | 8 | public function __construct($value) |
|
26 | { |
||
27 | 8 | if (false === is_resource($value)) { |
|
28 | 1 | throw new TypeError( |
|
29 | 'Argument 1 passed to drupol\valuewrapper\Resource\ResourceValue::__construct()' . |
||
30 | 1 | ' must be of the type Resource, ' . gettype($value) . ' given.' |
|
31 | ); |
||
32 | } |
||
33 | |||
34 | 7 | parent::__construct($value); |
|
35 | 7 | } |
|
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 1 | public function equals(ValueInterface $item, bool $strict = true): bool |
|
41 | { |
||
42 | 1 | return $this->hash() === $item->hash(); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 1 | public function serialize() |
|
51 | } |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 2 | public function type(): string |
|
57 | { |
||
58 | 2 | return get_resource_type($this->value()); |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | 1 | public function unserialize($serialized) |
|
67 | } |
||
68 | } |
||
69 |