State::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 0
crap 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