FormSubmissionClosure   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 17
ccs 0
cts 5
cp 0
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
namespace WebTheory\Saveyour\Processor;
4
5
use Closure;
6
use Psr\Http\Message\ServerRequestInterface;
7
use WebTheory\Saveyour\Contracts\Processor\FormDataProcessorInterface;
8
use WebTheory\Saveyour\Contracts\Report\FormProcessReportInterface;
9
use WebTheory\Saveyour\Processor\Abstracts\AbstractFormDataProcessor;
10
11
class FormSubmissionClosure extends AbstractFormDataProcessor implements FormDataProcessorInterface
12
{
13
    protected Closure $closure;
14
15
    public function __construct(string $name, ?array $fields, Closure $closure)
16
    {
17
        parent::__construct($name, $fields);
18
19
        $this->closure = $closure;
20
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function process(ServerRequestInterface $request, array $results): ?FormProcessReportInterface
26
    {
27
        return $this->closure->call($this, $request, $results);
28
    }
29
}
30