Completed
Branch BUG-11107-submit-button-text (9a9413)
by
unknown
31:37 queued 21:44
created

EE_Button_Display_Strategy   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B display() 0 25 3
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