ProcessedFormReport   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
dl 0
loc 39
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 1
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A inputReports() 0 3 1
A __construct() 0 5 1
A processReports() 0 3 1
A shieldReport() 0 3 1
A submissionIsValid() 0 9 3
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