ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ShortlinkDTO.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
29class ShortlinkDTO implements Shortlink
30{
31 public function __construct(
32 private string $alias,
33 private Type $target_type,
34 private TypeData $target_type_data,
35 private int $position,
36 private bool $active,
37 private int $used,
38 private ?string $id = null
39 ) {
40 }
41
42 public function withId(string $id): Shortlink
43 {
44 $clone = clone $this;
45 $clone->id = $id;
46 return $clone;
47 }
48
49 public function getId(): ?string
50 {
51 return $this->id;
52 }
53
54 public function withAlias(string $alias): Shortlink
55 {
56 $clone = clone $this;
57 $clone->alias = $alias;
58 return $clone;
59 }
60
61 public function getAlias(): string
62 {
63 return $this->alias;
64 }
65
66 public function getAliasForPresentation(string $prefix = ''): string
67 {
68 return rtrim($prefix, '/') . '/' . trim($this->alias, '/');
69 }
70
71 public function withTargetType(): Type
72 {
73 $clone = clone $this;
74 $clone->target_type = $target_type;
75 return $clone;
76 }
77
78 public function getTargetType(): Type
79 {
80 return $this->target_type;
81 }
82
84 {
85 $clone = clone $this;
86 $clone->target_type_data = $data;
87 return $clone;
88 }
89
90 public function getTargetData(): TypeData
91 {
92 return $this->target_type_data;
93 }
94
95 public function withPosition(int $position): Shortlink
96 {
97 $clone = clone $this;
98 $clone->position = $position;
99 return $clone;
100 }
101
102 public function getPosition(): int
103 {
104 return $this->position;
105 }
106
107 public function withActive(bool $active): Shortlink
108 {
109 $clone = clone $this;
110 $clone->active = $active;
111 return $clone;
112 }
113
114 public function isActive(): bool
115 {
116 return $this->active;
117 }
118
119 public function increaseUsage(): Shortlink
120 {
121 $clone = clone $this;
122 $clone->used++;
123 return $clone;
124 }
125
126 public function getUsed(): int
127 {
128 return $this->used;
129 }
130
131}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23