FormPost::submitted()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace hemio\form;
4
5
/**
6
 * Forms with the method POST
7
 * 
8
 * @since 1.0
9
 */
10
class FormPost extends Abstract_\Form {
11
12
    public function __construct($name, array $post = null, array $get = null, array $stored = []) {
13
        parent::__construct($name, $post, $get, $stored);
14
15
        $this['form_identifier'] = new InputHidden($this->getIdentifierName(), '');
16
17
        $this->setAttribute('method', 'post');
18
    }
19
20
    public function submitted() {
21
        return $this['form_identifier']->getValueUser() !== null;
22
    }
23
24
    public function getIdentifierName() {
25
        return '__form_identifier';
26
    }
27
28
    public function correctSubmitted() {
29
        return $this->submitted() && $this->dataValid();
30
    }
31
32
    public function getValueUser($key) {
33
        return $this->getPost($key);
34
    }
35
36
}
37