Completed
Push — EZP-31383 ( 83ce0c )
by
unknown
19:12
created

RoleCopyStruct::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
nc 1
nop 1
rs 10
1
<?php
2
3
/**
4
 * File containing the RoleCreateStruct class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\REST\Client\Values\User;
10
11
use eZ\Publish\API\Repository\Values;
12
use eZ\Publish\API\Repository\Values\User\RoleCopyStruct as APIRoleCopyStruct;
13
14
/**
15
 * Implementation of the {@link \eZ\Publish\API\Repository\Values\User\RoleCopyStruct}
16
 * class.
17
 *
18
 * @see \eZ\Publish\API\Repository\Values\User\RoleCopyStruct
19
 */
20
class RoleCopyStruct extends APIRoleCopyStruct
21
{
22
    /** @var \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct[] */
23
    private $policies = [];
24
25
    /**
26
     * Instantiates a role copy class.
27
     *
28
     * @param string $name
29
     */
30
    public function __construct($name)
31
    {
32
        parent::__construct(['newIdentifier' => $name]);
33
    }
34
35
    /**
36
     * Returns policies associated with the role.
37
     *
38
     * @return \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct[]
39
     */
40
    public function getPolicies()
41
    {
42
        return $this->policies;
43
    }
44
45
    /**
46
     * Adds a policy to this role.
47
     *
48
     * @param \eZ\Publish\API\Repository\Values\User\PolicyCreateStruct $policyCreateStruct
49
     */
50
    public function addPolicy(Values\User\PolicyCreateStruct $policyCreateStruct)
51
    {
52
        $this->policies[] = $policyCreateStruct;
53
    }
54
}
55