Resolution::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lamoda\GS1Parser\Validator;
6
7
final class Resolution
8
{
9
    /**
10
     * @var bool
11
     */
12
    private $isValid;
13
    /**
14
     * @var array
15
     */
16
    private $errors;
17
18 2
    private function __construct(bool $isValid, array $errors)
19
    {
20 2
        $this->isValid = $isValid;
21 2
        $this->errors = $errors;
22 2
    }
23
24 1
    public static function createValid(): self
25
    {
26 1
        return new static(true, []);
27
    }
28
29 1
    public static function createInvalid(array $errors): self
30
    {
31 1
        return new static(false, $errors);
32
    }
33
34 2
    public function isValid(): bool
35
    {
36 2
        return $this->isValid;
37
    }
38
39 2
    public function getErrors(): array
40
    {
41 2
        return $this->errors;
42
    }
43
44
}