Completed
Push — 1.0 ( 19670d...450ed0 )
by Valentin
09:36
created

UserObject   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 36
ccs 13
cts 13
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 3
A getMapper() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of Transfer.
5
 *
6
 * For the full copyright and license information, please view the LICENSE file located
7
 * in the root directory.
8
 */
9
10
namespace Transfer\EzPlatform\Data;
11
12
use Transfer\Data\ValueObject;
13
use Transfer\EzPlatform\Repository\Content\UserMapper;
14
15
/**
16
 * User object.
17
 */
18
class UserObject extends ValueObject
19
{
20
    /**
21
     * @var UserGroupObject[]
22
     */
23
    public $parents;
24
25
    /**
26
     * @var UserMapper
27
     */
28
    protected $mapper;
29
30 9
    public function __construct(array $data, array $properties = array())
31
    {
32 9
        if (isset($data['parents'])) {
33 8
            $this->parents = $data['parents'];
34 8
            unset($data['parents']);
35 8
        }
36
37 9
        $data['max_login'] = isset($data['max_login']) ? $data['max_login'] : null;
38
39 9
        parent::__construct($data, $properties);
40 9
    }
41
42
    /**
43
     * @return UserMapper
44
     */
45 6
    public function getMapper()
46
    {
47 6
        if (!$this->mapper) {
48 6
            $this->mapper = new UserMapper($this);
49 6
        }
50
51 6
        return $this->mapper;
52
    }
53
}
54