FormPost   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A submitted() 0 3 1
A getIdentifierName() 0 3 1
A correctSubmitted() 0 3 2
A getValueUser() 0 3 1
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