UserGroupObject   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 6
c 4
b 0
f 0
lcom 1
cbo 2
dl 0
loc 46
ccs 17
cts 17
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getMapper() 0 8 2
A setStructCallback() 0 4 1
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\Repository\Values;
11
12
use Transfer\EzPlatform\Repository\Values\Mapper\UserGroupMapper;
13
14
/**
15
 * User Group object.
16
 *
17
 * @see http://transfer-framework.com/docs/1.0/sources_and_targets/ezplatform/the_objects/usergroupobject.html
18
 */
19
class UserGroupObject extends EzPlatformObject
20
{
21
    /**
22
     * @var UserGroupMapper
23
     */
24
    private $mapper;
25
26
    /**
27
     * UserGroupObject constructor.
28
     *
29
     * @param mixed $data
30
     * @param array $properties
31 20
     */
32
    public function __construct(array $data, array $properties = array())
33 20
    {
34 10
        if (!isset($data['parent_id'])) {
35 10
            $data['parent_id'] = 12;
36 20
        }
37 2
        if (!isset($data['content_type_identifier'])) {
38 2
            $data['content_type_identifier'] = 'user_group';
39 20
        }
40 20
        parent::__construct($data, $properties);
41
    }
42
43
    /**
44
     * @return UserGroupMapper
45 20
     */
46
    public function getMapper()
47 20
    {
48 20
        if (!$this->mapper) {
49 20
            $this->mapper = new UserGroupMapper($this);
50
        }
51 20
52
        return $this->mapper;
53
    }
54
55
    /**
56
     * Allows direct control in UserGroupCreateStruct and UserGroupUpdateStruct.
57
     *
58
     * @param \Closure $callback
59 1
     */
60
    public function setStructCallback(\Closure $callback)
61 1
    {
62 1
        $this->setProperty('struct_callback', $callback);
63
    }
64
}
65