Passed
Push — master ( 192b45...fd1497 )
by Bruno
06:54
created

Element::factory()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3.072

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 10
nc 4
nop 2
dl 0
loc 15
ccs 8
cts 10
cp 0.8
crap 3.072
rs 9.9332
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Element::__construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium;
4
5
use Formularium\Exception\ClassNotFoundException;
6
use Formularium\HTMLNode;
7
8
/**
9
 * Abstract base classe to render HTML elements such as buttons.
10
 */
11
abstract class Element implements RenderableParameter
12
{
13
    /**
14
     * extra attributes added directly to the base element.
15
     */
16
    const ATTRIBUTES = 'attributes';
17
18
    /**
19
     * @var Framework
20
     */
21
    protected $framework;
22
23
    /**
24
     * @var FrameworkComposer
25 1
     */
26
    protected $composer;
27
28 1
    public function __construct(Framework $framework, FrameworkComposer $composer = null)
29 1
    {
30 1
        $this->framework = $framework;
31
        $this->composer = $composer;
32
    }
33 1
34
    /**
35 1
     * Renders a form editable version of this Element
36 1
     *
37
     * @param array $parameters
38
     * @param HTMLNode $previous
39 1
     * @return HTMLNode The HTML rendered.
40
     */
41
    abstract public function render(array $parameters, HTMLNode $previous): HTMLNode;
42
43
    /**
44
     * Documents this validator.
45
     *
46
     * @return Metadata
47 1
     */
48
    abstract public static function getMetadata(): Metadata;
49
}
50