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

TypeValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A doHash() 0 4 1
A hash() 0 4 1
A getType() 0 4 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