Completed
Push — master ( 9c1626...6bcea8 )
by Shcherbak
22:09 queued 19:43
created

Input::setValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
  namespace Fiv\Form\Element;
4
5
  /**
6
   * @author Ivan Shcherbak <[email protected]> 7/11/14
7
   */
8
  class Input extends BaseElement {
9
10
    /**
11
     * @var string
12
     */
13
    protected $tag = 'input';
14
15
    /**
16
     * @var array
17
     */
18
    protected $attributes = [
19
      'type' => 'text',
20
    ];
21
22
23
    /**
24
     * @return null|string
25
     */
26 1
    public function getType() {
27 1
      return $this->getAttribute('type');
28
    }
29
30
31
    /**
32
     * Alias of $this->setAttribute('type' 'text');
33
     *
34
     * @param string $type
35
     * @return $this
36
     */
37 6
    public function setType($type) {
38 6
      $this->setAttribute('type', strtolower($type));
39 6
      return $this;
40
    }
41
42
43
    /**
44
     * @param $value
45
     * @return $this
46
     */
47 16
    public function setValue($value) {
48 16
      $this->setAttribute('value', $value);
49 16
      return $this;
50
    }
51
52
53
  }