Completed
Push — develop ( 213046...ebc20b )
by Barry
01:37
created

State   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 30
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toArray() 0 4 1
A toHash() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Barryvanveen\CCA;
4
5
class State
6
{
7
    /** @var array */
8
    protected $array;
9
10
    /** @var string */
11
    protected $string;
12
    
13 9
    public function __construct(Grid $grid)
14
    {
15 9
        $this->array = $grid->toArray();
16
17 9
        $this->string = $grid->__toString();
18 9
    }
19
20 3
    public function toArray(): array
21
    {
22 3
        return $this->array;
23
    }
24
25 3
    public function toHash(): string
26
    {
27 3
        return hash('crc32', $this->string);
28
    }
29
30 3
    public function __toString()
31
    {
32 3
        return $this->string;
33
    }
34
}
35