2323 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2424 */
2525
26- namespace OC \Collaboration \Reference ;
27-
28- use OCP \Collaboration \Reference \IReference ;
26+ namespace OCP \Collaboration \Reference ;
2927
28+ /**
29+ * @since 25.0.0
30+ */
3031class Reference implements IReference {
31- private string $ reference ;
32+ protected string $ reference ;
3233
33- private bool $ accessible = true ;
34+ protected bool $ accessible = true ;
3435
35- private ?string $ title = null ;
36- private ?string $ description = null ;
37- private ?string $ imageUrl = null ;
38- private ?string $ contentType = null ;
39- private ?string $ url = null ;
36+ protected ?string $ title = null ;
37+ protected ?string $ description = null ;
38+ protected ?string $ imageUrl = null ;
39+ protected ?string $ contentType = null ;
40+ protected ?string $ url = null ;
4041
41- private ?string $ richObjectType = null ;
42- private ?array $ richObject = null ;
42+ protected ?string $ richObjectType = null ;
43+ protected ?array $ richObject = null ;
4344
45+ /**
46+ * @since 25.0.0
47+ */
4448 public function __construct (string $ reference ) {
4549 $ this ->reference = $ reference ;
4650 }
4751
52+ /**
53+ * @inheritdoc
54+ * @since 25.0.0
55+ */
4856 public function getId (): string {
4957 return $ this ->reference ;
5058 }
5159
60+ /**
61+ * @inheritdoc
62+ * @since 25.0.0
63+ */
5264 public function setAccessible (bool $ accessible ): void {
5365 $ this ->accessible = $ accessible ;
5466 }
5567
68+ /**
69+ * @inheritdoc
70+ * @since 25.0.0
71+ */
5672 public function getAccessible (): bool {
5773 return $ this ->accessible ;
5874 }
5975
76+ /**
77+ * @inheritdoc
78+ * @since 25.0.0
79+ */
6080 public function setTitle (string $ title ): void {
6181 $ this ->title = $ title ;
6282 }
6383
84+ /**
85+ * @inheritdoc
86+ * @since 25.0.0
87+ */
6488 public function getTitle (): string {
6589 return $ this ->title ?? $ this ->reference ;
6690 }
6791
92+ /**
93+ * @inheritdoc
94+ * @since 25.0.0
95+ */
6896 public function setDescription (?string $ description ): void {
6997 $ this ->description = $ description ;
7098 }
7199
100+ /**
101+ * @inheritdoc
102+ * @since 25.0.0
103+ */
72104 public function getDescription (): ?string {
73105 return $ this ->description ;
74106 }
75107
108+ /**
109+ * @inheritdoc
110+ * @since 25.0.0
111+ */
76112 public function setImageUrl (?string $ imageUrl ): void {
77113 $ this ->imageUrl = $ imageUrl ;
78114 }
79115
116+ /**
117+ * @inheritdoc
118+ * @since 25.0.0
119+ */
80120 public function getImageUrl (): ?string {
81121 return $ this ->imageUrl ;
82122 }
83123
124+ /**
125+ * @inheritdoc
126+ * @since 25.0.0
127+ */
84128 public function setImageContentType (?string $ contentType ): void {
85129 $ this ->contentType = $ contentType ;
86130 }
87131
132+ /**
133+ * @inheritdoc
134+ * @since 25.0.0
135+ */
88136 public function getImageContentType (): ?string {
89137 return $ this ->contentType ;
90138 }
91139
140+ /**
141+ * @inheritdoc
142+ * @since 25.0.0
143+ */
92144 public function setUrl (?string $ url ): void {
93145 $ this ->url = $ url ;
94146 }
95147
148+ /**
149+ * @inheritdoc
150+ * @since 25.0.0
151+ */
96152 public function getUrl (): ?string {
97153 return $ this ->url ;
98154 }
99155
156+ /**
157+ * @inheritdoc
158+ * @since 25.0.0
159+ */
100160 public function setRichObject (string $ type , ?array $ richObject ): void {
101161 $ this ->richObjectType = $ type ;
102162 $ this ->richObject = $ richObject ;
103163 }
104164
165+ /**
166+ * @inheritdoc
167+ * @since 25.0.0
168+ */
105169 public function getRichObjectType (): string {
106170 if ($ this ->richObjectType === null ) {
107171 return 'open-graph ' ;
108172 }
109173 return $ this ->richObjectType ;
110174 }
111175
176+ /**
177+ * @inheritdoc
178+ * @since 25.0.0
179+ */
112180 public function getRichObject (): array {
113181 if ($ this ->richObject === null ) {
114182 return $ this ->getOpenGraphObject ();
115183 }
116184 return $ this ->richObject ;
117185 }
118186
187+ /**
188+ * @inheritdoc
189+ * @since 25.0.0
190+ */
119191 public function getOpenGraphObject (): array {
120192 return [
121193 'id ' => $ this ->getId (),
@@ -126,6 +198,11 @@ public function getOpenGraphObject(): array {
126198 ];
127199 }
128200
201+ /**
202+ * @param IReference $reference
203+ * @return array
204+ * @since 25.0.0
205+ */
129206 public static function toCache (IReference $ reference ): array {
130207 return [
131208 'id ' => $ reference ->getId (),
@@ -140,6 +217,11 @@ public static function toCache(IReference $reference): array {
140217 ];
141218 }
142219
220+ /**
221+ * @param array $cache
222+ * @return IReference
223+ * @since 25.0.0
224+ */
143225 public static function fromCache (array $ cache ): IReference {
144226 $ reference = new Reference ($ cache ['id ' ]);
145227 $ reference ->setTitle ($ cache ['title ' ]);
@@ -152,6 +234,10 @@ public static function fromCache(array $cache): IReference {
152234 return $ reference ;
153235 }
154236
237+ /**
238+ * @inheritdoc
239+ * @since 25.0.0
240+ */
155241 public function jsonSerialize () {
156242 return [
157243 'richObjectType ' => $ this ->getRichObjectType (),
0 commit comments