UIDialog   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 33
rs 10
wmc 4
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A showButtons() 0 5 2
1
<?php
2
3
namespace Asymptix\ui\controls;
4
5
/**
6
 * Dialog UI class controll.
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 UIDialog extends \Asymptix\ui\UIControl {
16
    /**
17
     * Default dialog panel HTML template.
18
     */
19
    const DEFAULT_TEMPLATE = "/../templates/controls/ui_dialog.tpl.php";
20
21
    /**
22
     * Text of the dialog message.
23
     */
24
    protected $text = "";
25
26
    /**
27
     * List of dialog buttons.
28
     *
29
     * @var array<UIButton>
30
     */
31
    protected $buttons = [];
32
33
    public function __construct($attributesList = [], $buttons = [], $template = "") {
34
        $this->buttons = $buttons;
35
36
        if (empty($template)) {
37
            $template = __DIR__ . self::DEFAULT_TEMPLATE;
38
        }
39
        parent::__construct($attributesList, $template);
40
    }
41
42
    public function showButtons() {
43
        foreach ($this->buttons as $btn) {
44
            $btn->show();
45
        }
46
    }
47
}
48