Passed
Push — master ( fd1497...9b6942 )
by Bruno
07:31
created

Element   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 84.62%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 43
rs 10
ccs 11
cts 13
cp 0.8462
wmc 2

2 Methods

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