Completed
Push — develop ( dfd31d...f6e11d )
by
unknown
17:02
created

UserPassword::factory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 2 Features 0
Metric Value
c 2
b 2
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
namespace Auth\Form;
11
12
use Core\Form\Form;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
use Auth\Form\Hydrator\UserPasswordHydrator;
15
16
class UserPassword extends Form
17
{
18
    /**
19
     * @var ServiceLocatorInterface
20
     */
21
    protected $forms;
22
    
23
    public function getHydrator()
24
    {
25
        if (!$this->hydrator) {
26
            $hydrator = new UserPasswordHydrator();
27
            $this->setHydrator($hydrator);
28
        }
29
        return $this->hydrator;
30
    }
31
    
32
    public function init()
33
    {
34
        $this->setName('user-password-form');
35
36
        $this->add(
37
            array(
38
            'type' => 'hidden',
39
            'name' => 'id',
40
            )
41
        );
42
        
43
        $this->add(
44
            $this->forms->get('Auth/UserPasswordFieldset')
45
        );
46
        
47
        $this->add($this->forms->get('submitField'));
48
    }
49
    
50
    /**
51
     * @param ServiceLocatorInterface $forms
52
     * @return UserPassword
53
     */
54
    public static function factory(ServiceLocatorInterface $forms)
55
    {
56
        $form = new static();
57
        $form->forms = $forms;
58
        
59
		return $form;
60
    }
61
}
62