Completed
Pull Request — 1.0 (#36)
by Harald
12:37
created

UserGroupObject::getMapper()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 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\UserGroupMapper;
14
15
/**
16
 * User Group object.
17
 */
18
class UserGroupObject extends ValueObject
19
{
20
    /**
21
     * @var UserGroupMapper
22
     */
23
    private $mapper;
24
25
    /**
26
     * UserGroupObject constructor.
27
     *
28
     * @param mixed $data
29
     * @param array $properties
30
     */
31 20
    public function __construct(array $data, array $properties = array())
32
    {
33 20
        if (!isset($data['parent_id'])) {
34 10
            $data['parent_id'] = 12;
35 10
        }
36 20
        if (!isset($data['main_language_code'])) {
37 10
            $data['main_language_code'] = 'eng-GB';
38 10
        }
39 20
        if (!isset($data['content_type_identifier'])) {
40 10
            $data['content_type_identifier'] = 'user_group';
41 10
        }
42 20
        parent::__construct($data, $properties);
43 20
    }
44
45
    /**
46
     * @return UserGroupMapper
47
     */
48 12
    public function getMapper()
49
    {
50 12
        if (!$this->mapper) {
51 12
            $this->mapper = new UserGroupMapper($this);
52 12
        }
53
54 12
        return $this->mapper;
55
    }
56
}
57