UIButton::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 3
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace Asymptix\ui\components;
4
5
/**
6
 * UI Button component class.
7
 *
8
 * @category Asymptix PHP Framework
9
 * @author Dmytro Zarezenko <[email protected]>
10
 * @copyright (c) 2009 - 2016, Dmytro Zarezenko
11
 *
12
 * @git https://github.com/Asymptix/Framework
13
 * @license http://opensource.org/licenses/MIT
14
 */
15
class UIButton extends \Asymptix\ui\UIComponent {
16
17
    const DEFAULT_TEMPLATE = "/../templates/components/ui_button.tpl.php";
18
19
    const BTN_RESET = "reset";
20
    const BTN_BUTTON = "button";
21
    const BTN_SUBMIT = "submit";
22
23
    protected $type = self::BTN_BUTTON;
24
25
    protected $isClose = false;
26
27
    public function __construct($attribs = [], $template = null, $show = false) {
28
        if (empty($template)) {
29
            $template = __DIR__ . self::DEFAULT_TEMPLATE;
30
        }
31
32
        if ($show) {
33
            parent::__construct($attribs, $template);
34
        } else {
35
            $this->template = $template;
36
            $this->setAttributes($attribs);
37
        }
38
    }
39
}
40