State   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 28
c 0
b 0
f 0
ccs 10
cts 10
cp 1
rs 10

4 Methods

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