Completed
Push — master ( e238c3...0855a3 )
by Pol
13:48 queued 01:17
created

TypeValue::doHash()   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 1
crap 1
1
<?php
2
3
namespace drupol\valuewrapper\Type;
4
5
use drupol\valuewrapper\AbstractValue;
6
7
class TypeValue extends AbstractValue
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12 3
    protected function doHash(string $string) : string
13
    {
14 3
        return \sha1($string);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 1
    public function hash(): string
21
    {
22 1
        return $this->doHash($this->getType() . $this->value);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 3
    public function getType()
29
    {
30 3
        return \gettype($this->value);
31
    }
32
}
33