Completed
Push — master ( 66e031...6f08f5 )
by Shcherbak
8s
created

Submit   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 2
c 5
b 1
f 1
lcom 1
cbo 2
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A isSubmitted() 0 3 1
1
<?php
2
3
  /**
4
   * @author Ivan Shcherbak <[email protected]>
5
   */
6
  namespace Fiv\Form\Element;
7
8
  use Fiv\Form\FormData;
9
10
  /**
11
   * Generate <input type="submit" /> element
12
   *
13
   * @author Ivan Shcherbak <[email protected]>
14
   */
15
  class Submit extends \Fiv\Form\Element\Input {
16
17
    /**
18
     * @var array
19
     */
20
    protected $attributes = [
21
      'type' => 'submit',
22
    ];
23
24
    /**
25
     * @var bool
26
     */
27
    private $isSubmitted = false;
28
29
30
    /**
31
     * @inheritdoc
32
     */
33 3
    public function handle(FormData $data) {
34 3
      $this->isSubmitted = $data->get($this->getName()) !== null;
35 3
    }
36
37
38
    /**
39
     * @return bool
40
     */
41 1
    public function isSubmitted() {
42 1
      return $this->isSubmitted;
43
    }
44
45
  }