Completed
Push — master ( 1b2836...6cdecb )
by Pol
10:22
created

ObjectValue::type()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\valuewrapper\Object;
6
7
use drupol\valuewrapper\AbstractValue;
8
use drupol\valuewrapper\ValueInterface;
9
10
/**
11
 * Class ObjectValue
12
 */
13
abstract class ObjectValue extends AbstractValue implements ObjectValueInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 2
    public function equals(ValueInterface $item, bool $strict = true): bool
19
    {
20 2
        return $this->hash() == $item->hash();
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function class(): string
0 ignored issues
show
Bug introduced by
Possible parse error: non-abstract method defined as abstract
Loading history...
27
    {
28
        return \get_class($this->value());
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $this.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 5
    public function type(): string
35
    {
36 5
        return 'object';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 4
    public function apply(callable $callable)
43
    {
44 4
        $value = clone $this->value();
45
46 4
        return $callable($value);
47
    }
48
}
49