forked from neos/neos-development-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorkspaceDescription.php
44 lines (36 loc) · 906 Bytes
/
WorkspaceDescription.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
namespace Neos\Neos\Domain\Model;
use Neos\Flow\Annotations as Flow;
/**
* Description for a workspace
*
* @api
*/
#[Flow\Proxy(false)]
final readonly class WorkspaceDescription implements \JsonSerializable
{
public function __construct(
public string $value,
) {
if (preg_match('/^[\p{L}\p{P}\d \.]{0,500}$/u', $this->value) !== 1) {
throw new \InvalidArgumentException('Invalid workspace description given.', 1505831660363);
}
}
public static function fromString(string $value): self
{
return new self($value);
}
public static function createEmpty(): self
{
return new self('');
}
public function jsonSerialize(): string
{
return $this->value;
}
public function equals(self $other): bool
{
return $this->value === $other->value;
}
}