Segment.php
1.17 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
namespace ACP\Search\Entity;
use AC\Type\ListScreenId;
use ACP\Search\Type\SegmentKey;
final class Segment
{
private $key;
private $list_screen_id;
private $user_id;
private $name;
private $url_parameters;
public function __construct(
SegmentKey $key,
ListScreenId $list_screen_id,
string $name,
array $url_parameters,
int $user_id = null
) {
$this->key = $key;
$this->list_screen_id = $list_screen_id;
$this->name = $name;
$this->url_parameters = $url_parameters;
$this->user_id = $user_id;
}
public function get_key(): SegmentKey
{
return $this->key;
}
public function get_list_screen_id(): ListScreenId
{
return $this->list_screen_id;
}
public function get_user_id(): ?int
{
return $this->user_id;
}
public function get_name(): string
{
return $this->name;
}
public function get_url_parameters(): array
{
return $this->url_parameters;
}
public function is_global(): bool
{
return $this->get_user_id() === null;
}
}