Button::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of slick/form package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Form\Renderer;
11
12
use Slick\I18n\TranslateMethods;
13
14
/**
15
 * HTML Button renderer
16
 *
17
 * @package Slick\Form\Renderer
18
 */
19
class Button extends Div implements RendererInterface
20
{
21
22
    /**
23
     * Needed for button translation
24
     */
25
    use TranslateMethods;
26
27
    /**
28
     * @var string The template file to use in the rendering
29
     */
30
    public $template = 'form-elements/button.twig';
31
32
    /**
33
     * Render the HTML element in the provided context
34
     *
35
     * @param array $context
36
     *
37
     * @return string The HTML string output
38
     */
39 8
    public function render($context = [])
40
    {
41 8
        $this->element->setValue(
42 8
            $this->translate($this->element->getValue())
43 8
        );
44 8
        return parent::render($context);
45
    }
46
}
47