Passed
Push — master ( 4c5faf...429320 )
by Chris
04:23
created

AbstractForm   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFormSubmissionManager() 0 4 1
A getFormValidators() 0 3 1
1
<?php
2
3
namespace WebTheory\Saveyour;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
use WebTheory\Saveyour\Contracts\FormInterface;
7
use WebTheory\Saveyour\Contracts\FormSubmissionManagerInterface;
8
use WebTheory\Saveyour\Contracts\FormValidatorInterface;
9
use WebTheory\Saveyour\Controllers\FormSubmissionManager;
10
11
abstract class AbstractForm implements FormInterface
12
{
13
    /**
14
     *
15
     */
16
    abstract protected function getAction(): string;
17
18
    /**
19
     *
20
     */
21
    abstract protected function getMethod(): string;
22
23
    /**
24
     *
25
     */
26
    abstract protected function getFieldControllers();
27
28
    /**
29
     *
30
     */
31
    protected function getFormSubmissionManager(): FormSubmissionManager
32
    {
33
        return (new FormSubmissionManager())
34
            ->setValidators($this->getFormValidators());
35
    }
36
37
    /**
38
     * @return array|FormValidatorInterface[]
39
     */
40
    protected function getFormValidators(): array
41
    {
42
        return [];
43
    }
44
}
45