ValidationReport::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace WebTheory\Saveyour\Report;
4
5
use WebTheory\Saveyour\Contracts\Report\ValidationReportInterface;
6
7
class ValidationReport implements ValidationReportInterface
8
{
9
    protected bool $validationStatus;
10
11
    protected array $ruleViolations = [];
12
13 12
    public function __construct(bool $status, string ...$violations)
14
    {
15 12
        $this->validationStatus = $status;
16 12
        $this->ruleViolations = $violations;
17
    }
18
19 12
    public function validationStatus(): bool
20
    {
21 12
        return $this->validationStatus;
22
    }
23
24
    /**
25
     * @return array<int,string>
26
     */
27 6
    public function ruleViolations(): array
28
    {
29 6
        return $this->ruleViolations;
30
    }
31
32
    public static function voided(): ValidationReportInterface
33
    {
34
        return new static(false);
35
    }
36
}
37