Completed
Push — master ( fd10c7...b50c82 )
by Craig
06:29
created

UserFormDataEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getFormData() 0 8 2
A getUserEntity() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Zikula package.
5
 *
6
 * Copyright Zikula Foundation - http://zikula.org/
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zikula\UsersModule\Event;
13
14
use Symfony\Component\EventDispatcher\Event;
15
use Symfony\Component\Form\FormInterface;
16
use Zikula\UsersModule\Entity\UserEntity;
17
18
class UserFormDataEvent extends Event
19
{
20
    /**
21
     * @var FormInterface
22
     */
23
    private $form;
24
25
    /**
26
     * @var UserEntity
27
     */
28
    private $userEntity;
29
30
    /**
31
     * @param UserEntity $userEntity
32
     * @param FormInterface $form
33
     */
34
    public function __construct(UserEntity $userEntity, FormInterface $form)
35
    {
36
        $this->userEntity = $userEntity;
37
        $this->form = $form;
38
    }
39
40
    /**
41
     * @param null $prefix
42
     * @return array
43
     */
44
    public function getFormData($prefix = null)
45
    {
46
        if (isset($prefix)) {
47
            return $this->form->get($prefix)->getData();
48
        }
49
50
        return $this->form->getData();
51
    }
52
53
    /**
54
     * @return UserEntity
55
     */
56
    public function getUserEntity()
57
    {
58
        return $this->userEntity;
59
    }
60
}
61