Completed
Branch BUG-11108-ticket-reserved-coun... (144d27)
by
unknown
14:21 queued 17s
created

EE_Button_Display_Strategy::display()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 25
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 18
nc 4
nop 0
dl 0
loc 25
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
4
5
/**
6
 * Class EE_Button_Display_Strategy
7
 * Description
8
 *
9
 * @package       Event Espresso
10
 * @author        Mike Nelson
11
 */
12
class EE_Button_Display_Strategy extends EE_Display_Strategy_Base
13
{
14
15
    /**
16
     * @return string of html to display the input
17
     */
18
    public function display()
19
    {
20
        $default_value = $this->_input->get_default();
21
        if ($this->_input->get_normalization_strategy() instanceof EE_Normalization_Strategy_Base) {
22
            $default_value = $this->_input->get_normalization_strategy()->unnormalize($default_value);
23
        }
24
        $html = $this->_opening_tag('button');
25
        $html .= $this->_attributes_string(
26
            array_merge(
27
                $this->_standard_attributes_array(),
28
                array(
29
                    'value' => $default_value,
30
                )
31
            )
32
        );
33
        if ($this->_input instanceof EE_Button_Input) {
34
            $button_content = $this->_input->button_content();
35
        } else {
36
            $button_content = $this->_input->get_default();
37
        }
38
        $html .= '>';
39
        $html .= $button_content;
40
        $html .= $this->_closing_tag();
41
        return $html;
42
    }
43
}
44