Completed
Push — master ( a76588...627495 )
by Pol
02:01
created

TypeValue::equals()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\valuewrapper\Type;
6
7
use drupol\valuewrapper\AbstractValue;
8
use drupol\valuewrapper\ValueInterface;
9
10
abstract class TypeValue extends AbstractValue
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 4
    public function hash(): string
16
    {
17 4
        return $this->doHash($this->getType() . $this->get());
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 13
    public function getType()
24
    {
25 13
        return \gettype($this->get());
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function equals(ValueInterface $item, $strict = true) : bool
32
    {
33
        return ($strict === true) ?
34
            $this === $item:
35
            $this == $item;
36
    }
37
}
38