Submit   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 63
ccs 0
cts 33
cp 0
rs 10
c 0
b 0
f 0
wmc 9
lcom 1
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A classes() 0 7 1
A applyWidth() 0 3 1
A inputAttributes() 0 6 1
A renderTitle() 0 9 4
A renderInner() 0 4 1
1
<?php
2
namespace Rocket\UI\Forms\Fields;
3
4
/**
5
 * Manage submit field
6
 */
7
8
/**
9
 * Submit field
10
 *
11
 * @author Stéphane Goetz
12
 * @deprecated
13
 */
14
class Submit extends Field
15
{
16
    /**
17
     * Extends the type
18
     * @param string $id
19
     * @param array $data
20
     */
21
    public function __construct($id, $data = [])
22
    {
23
        $this->type = 'submit';
24
25
        parent::__construct($id, $data);
26
    }
27
28
    /**
29
     * Remove the default class
30
     */
31
    protected function classes()
32
    {
33
        $this->label_attributes['class'] = ['columns'];
34
        $this->label_attributes['style']['float'] = 'left';
35
        $this->input_attributes['class'] = ['btn'];
36
        parent::classes();
37
    }
38
39
    /**
40
     * So that we can't set the width
41
     */
42
    protected function applyWidth()
43
    {
44
    }
45
46
    /**
47
     * Adds some specific attributes
48
     */
49
    protected function inputAttributes()
50
    {
51
        $this->input_attributes['name'] = $this->name;
52
        $this->input_attributes['type'] = 'submit';
53
        $this->input_attributes['value'] = $this->params['title'];
54
    }
55
56
    /**
57
     * Adds a title
58
     */
59
    protected function renderTitle()
60
    {
61
        $this->result .= '<span' . $this->renderAttributes($this->span_attributes) . '>&nbsp;</span>';
62
63
        if ($this->params['inline'] == false && $this->params['title'] != ''
64
            && $this->params['label_position'] == 'before') {
65
            $this->result .= '<br />';
66
        }
67
    }
68
69
    /**
70
     * Renders the field
71
     */
72
    protected function renderInner()
73
    {
74
        $this->result .= '<input' . $this->renderAttributes($this->input_attributes) . ' />';
75
    }
76
}
77