Completed
Push — master ( cd00c2...c10be1 )
by Joshua
13s queued 11s
created

WorkspaceCollectionEntry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the -SeamsCMSDeliverySdk package.
7
 *
8
 * (c) Seams-CMS.com
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace SeamsCMS\Delivery\Model;
15
16
/**
17
 * Class WorkspaceCollectionEntry
18
 * @package SeamsCMS\Delivery\Model
19
 */
20
class WorkspaceCollectionEntry
21
{
22
    use HydratorTrait {
23
        fromArray as private fromArrayTrait;
24
    }
25
26
    /** @var string */
27
    protected $id;
28
    /** @var string */
29
    protected $name;
30
    /** @var string */
31
    protected $description;
32
    /** @var bool */
33
    protected $isArchived;
34
    /** @var string */
35
    protected $organisation;
36
    /** @var Locale[] */
37
    protected $locales;
38
39
40
    /**
41
     * WorkspaceCollectionEntry constructor.
42
     *
43
     */
44
    protected function __construct()
45
    {
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getId(): string
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getName(): string
60
    {
61
        return $this->name;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getDescription(): string
68
    {
69
        return $this->description;
70
    }
71
72
    /**
73
     * @return bool
74
     */
75
    public function isArchived(): bool
76
    {
77
        return $this->isArchived;
78
    }
79
80
    /**
81
     * @return string
82
     */
83
    public function getOrganisation(): string
84
    {
85
        return $this->organisation;
86
    }
87
88
    /**
89
     * @return Locale[]
90
     */
91
    public function getLocales(): array
92
    {
93
        return $this->locales;
94
    }
95
96
    /**
97
     * @param array $data
98
     * @return WorkspaceCollectionEntry
99
     */
100
    public static function fromArray(array $data)
101
    {
102
        $data['locales'] = array_map(
103
            function ($item) {
104
                return Locale::fromArray($item);
105
            },
106
            $data['locales']
107
        );
108
109
        return self::fromArrayTrait($data);
110
    }
111
}
112