FormProcessReportBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 24
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 2
A withProcessResult() 0 5 1
A build() 0 3 1
1
<?php
2
3
namespace WebTheory\Saveyour\Report\Builder;
4
5
use WebTheory\Saveyour\Contracts\Report\Builder\FormProcessReportBuilderInterface;
6
use WebTheory\Saveyour\Contracts\Report\FormProcessReportInterface;
7
use WebTheory\Saveyour\Report\FormProcessReport;
8
9
class FormProcessReportBuilder implements FormProcessReportBuilderInterface
10
{
11
    protected $results;
12
13 9
    public function __construct(FormProcessReportInterface $previous = null)
14
    {
15 9
        if ($previous) {
16
            $this->results = $previous->results();
17
        }
18
    }
19
20
    /**
21
     * @return $this
22
     */
23 9
    public function withProcessResult(string $process, $result): FormProcessReportBuilderInterface
24
    {
25 9
        $this->results[$process] = $result;
26
27 9
        return $this;
28
    }
29
30 9
    public function build(): FormProcessReportInterface
31
    {
32 9
        return new FormProcessReport($this->results);
33
    }
34
}
35