1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Seams-CMS Delivery SDK 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 = false; |
34
|
|
|
/** @var string */ |
35
|
|
|
protected $organisation = ""; |
36
|
|
|
/** @var Locale[] */ |
37
|
|
|
protected $locales = []; |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* WorkspaceCollectionEntry constructor. |
42
|
|
|
* |
43
|
|
|
*/ |
44
|
3 |
|
final protected function __construct() |
45
|
|
|
{ |
46
|
3 |
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
1 |
|
public function getId(): string |
52
|
|
|
{ |
53
|
1 |
|
return $this->id; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
1 |
|
public function getName(): string |
60
|
|
|
{ |
61
|
1 |
|
return $this->name; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
1 |
|
public function getDescription(): string |
68
|
|
|
{ |
69
|
1 |
|
return $this->description; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return bool |
74
|
|
|
*/ |
75
|
1 |
|
public function isArchived(): bool |
76
|
|
|
{ |
77
|
1 |
|
return $this->isArchived; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
1 |
|
public function getOrganisation(): string |
84
|
|
|
{ |
85
|
1 |
|
return $this->organisation; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return Locale[] |
90
|
|
|
*/ |
91
|
2 |
|
public function getLocales(): array |
92
|
|
|
{ |
93
|
2 |
|
return $this->locales; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param array $data |
98
|
|
|
* @return WorkspaceCollectionEntry |
99
|
|
|
*/ |
100
|
3 |
|
public static function fromArray(array $data) |
101
|
|
|
{ |
102
|
3 |
|
$data['locales'] = array_map( |
103
|
3 |
|
function ($item) { |
104
|
1 |
|
return Locale::fromArray($item); |
105
|
3 |
|
}, |
106
|
3 |
|
$data['locales'] ?? [] |
107
|
|
|
); |
108
|
|
|
|
109
|
3 |
|
return self::fromArrayTrait($data); |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|