Completed
Pull Request — master (#591)
by Richard
14:41
created

Button::__construct()   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
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
13
namespace Xoops\Html;
14
15
/**
16
 * Img - Render an html img tag
17
 *
18
 * @category  Xoops\Html\Img
19
 * @package   Xoops\Html
20
 * @author    Richard Griffith <[email protected]>
21
 * @copyright 2019 XOOPS Project (https://xoops.org)
22
 * @license   GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
23
 */
24
class Button extends Attributes
25
{
26
    /**
27
     * __construct
28
     *
29
     * @param array $attributes array of attribute name => value pairs for button tag.
30
     *                          Pass the button text as 'value' attribute.
31
     */
32 4
    public function __construct($attributes = array())
33
    {
34 4
        parent::__construct($attributes);
35 4
    }
36
37
    /**
38
     * render a button
39
     *
40
     * @return string
41
     */
42 3
    public function render()
43
    {
44 3
        $this->suppressRender(['value']);
45 3
        $tag = '<button ' . $this->renderAttributeString() . '>'
46 3
            . $this->get('value', '')
47 3
            . '</button>';
48
49 3
        return $tag;
50
    }
51
}
52