Passed
Push — 5.x ( 65a76f...3a1e20 )
by Enjoys
59s queued 13s
created

AbstractRenderer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A setForm() 0 4 1
A getForm() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Renderer;
6
7
use Enjoys\Forms\Form;
8
use Enjoys\Forms\Interfaces\RendererInterface;
9
10
abstract class AbstractRenderer implements RendererInterface
11
{
12
    private Form $form;
13
14 1
    public function __construct(Form $form = null)
15
    {
16 1
        $this->form = $form ?? new Form();
17
    }
18
19
    abstract public function output(): string;
20
21 1
    public function setForm(Form $form): Form
22
    {
23 1
        $this->form = $form;
24 1
        return $this->form;
25
    }
26
27 1
    public function getForm(): Form
28
    {
29 1
        return $this->form;
30
    }
31
}
32