ValidationReport   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A ruleViolations() 0 3 1
A voided() 0 3 1
A __construct() 0 4 1
A validationStatus() 0 3 1
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