Completed
Pull Request — 1.x (#641)
by
unknown
15:00
created

Base   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 2
c 5
b 1
f 2
lcom 0
cbo 3
dl 0
loc 89
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 3 1
B __construct() 0 82 1
1
<?php
2
3
namespace ZfcUser\Form;
4
5
use Zend\Form\Element;
6
use ZfcBase\Form\ProvidesEventsForm;
7
8
class Base extends ProvidesEventsForm
9
{
10
    public function __construct()
11
    {
12
        parent::__construct();
13
14
        $this->add(array(
15
            'name' => 'username',
16
            'options' => array(
17
                'label' => 'Username',
18
            ),
19
            'attributes' => array(
20
                'type' => 'text'
21
            ),
22
        ));
23
24
        $this->add(array(
25
            'name' => 'email',
26
            'options' => array(
27
                'label' => 'Email',
28
            ),
29
            'attributes' => array(
30
                'type' => 'text'
31
            ),
32
        ));
33
34
        $this->add(array(
35
            'name' => 'display_name',
36
            'options' => array(
37
                'label' => 'Display Name',
38
            ),
39
            'attributes' => array(
40
                'type' => 'text'
41
            ),
42
        ));
43
44
        $this->add(array(
45
            'name' => 'password',
46
            'type' => 'password',
47
            'options' => array(
48
                'label' => 'Password',
49
            ),
50
            'attributes' => array(
51
                'type' => 'password'
52
            ),
53
        ));
54
55
        $this->add(array(
56
            'name' => 'passwordVerify',
57
            'type' => 'password',
58
            'options' => array(
59
                'label' => 'Password Verify',
60
            ),
61
            'attributes' => array(
62
                'type' => 'password'
63
            ),
64
        ));
65
66
        $submitElement = new Element\Button('submit');
67
        $submitElement
68
            ->setLabel('Submit')
69
            ->setAttributes(array(
70
                'type'  => 'submit',
71
            ));
72
73
        $this->add($submitElement, array(
74
            'priority' => -100,
75
        ));
76
77
        $this->add(array(
78
            'name' => 'userId',
79
            'type' => 'Zend\Form\Element\Hidden',
80
            'attributes' => array(
81
                'type' => 'hidden'
82
            ),
83
        ));
84
85
        // @TODO: Fix this... getValidator() is a protected method.
86
        //$csrf = new Element\Csrf('csrf');
87
        //$csrf->getValidator()->setTimeout($this->getRegistrationOptions()->getUserFormTimeout());
88
        //$this->add($csrf);
89
90
        $this->getEventManager()->trigger('init', $this);
91
    }
92
93
    public function init()
94
    {
95
    }
96
}
97