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

Element::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 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