ProcessedFormReport::submissionIsValid()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 4
nc 3
nop 0
dl 0
loc 9
ccs 0
cts 0
cp 0
crap 12
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace WebTheory\Saveyour\Report;
4
5
use WebTheory\Saveyour\Contracts\Report\FormShieldReportInterface;
6
use WebTheory\Saveyour\Contracts\Report\ProcessedFormReportInterface;
7
8
class ProcessedFormReport implements ProcessedFormReportInterface
9
{
10
    protected FormShieldReportInterface $shieldReport;
11
12
    protected array $inputReports = [];
13
14
    protected array $processReports = [];
15
16 45
    public function __construct(FormShieldReportInterface $shieldReport, array $inputReports, array $processReports)
17
    {
18 45
        $this->shieldReport = $shieldReport;
19 45
        $this->inputReports = $inputReports;
20 45
        $this->processReports = $processReports;
21
    }
22
23 6
    public function shieldReport(): FormShieldReportInterface
24
    {
25 6
        return $this->shieldReport;
26
    }
27
28 12
    public function inputReports(): array
29
    {
30 12
        return $this->inputReports;
31
    }
32
33 6
    public function processReports(): array
34
    {
35 6
        return $this->processReports;
36
    }
37
38
    public function submissionIsValid(): bool
39
    {
40
        foreach ($this->inputReports as $report) {
41
            if (!$report->submissionIsValid()) {
42
                return false;
43
            }
44
        }
45
46
        return true;
47
    }
48
}
49