Submit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 2
c 2
b 1
f 1
lcom 1
cbo 2
dl 0
loc 28
ccs 0
cts 6
cp 0
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
    public function handle(FormData $data) {
34
      $this->isSubmitted = $data->has($this->getName());
35
    }
36
37
38
    public function isSubmitted() : bool {
39
      return $this->isSubmitted;
40
    }
41
42
  }