Submit::isSubmitted()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
  }