| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * @package VikBooking |
| 4 | 4 | * @subpackage core |
| 5 | 5 | * @author E4J s.r.l. |
| 6 | - * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. | |
| 6 | + * @copyright Copyright (C) 2026 E4J s.r.l. All Rights Reserved. | |
| 7 | 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | 8 | * @link https://vikwp.com |
| 9 | 9 | */ |
| 10 | 10 | |
| @@ -39,8 +39,16 @@ | ||
| 39 | 39 | */ |
| 40 | 40 | protected $context = null; |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | + * Searches the messages under the specified context aliases. | |
| 44 | + * | |
| 45 | + * @var string[] | |
| 46 | + * @since 1.8.8 | |
| 47 | + */ | |
| 48 | + protected $categories = []; | |
| 49 | + | |
| 50 | + /** | |
| 43 | 51 | * Searches the messages by ID. |
| 44 | 52 | * The object contains the "id" and "operator" properties. |
| 45 | 53 | * |
| 46 | 54 | * @var object|null |
| @@ -84,8 +92,16 @@ | ||
| 84 | 92 | */ |
| 85 | 93 | protected $aggregate = false; |
| 86 | 94 | |
| 87 | 95 | /** |
| 96 | + * The ID of the external resource the message is linked to. | |
| 97 | + * | |
| 98 | + * @var string|null | |
| 99 | + * @since 1.8.8 | |
| 100 | + */ | |
| 101 | + protected $refId = null; | |
| 102 | + | |
| 103 | + /** | |
| 88 | 104 | * Sets the specified pagination offset. |
| 89 | 105 | * |
| 90 | 106 | * @param int $start |
| 91 | 107 | * |
| @@ -186,8 +202,48 @@ | ||
| 186 | 202 | return $this->context; |
| 187 | 203 | } |
| 188 | 204 | |
| 189 | 205 | /** |
| 206 | + * Sets the supported categories. | |
| 207 | + * | |
| 208 | + * @param string[] $categories | |
| 209 | + * | |
| 210 | + * @return self | |
| 211 | + * | |
| 212 | + * @since 1.8.8 | |
| 213 | + */ | |
| 214 | + public function forCategories(array $categories) | |
| 215 | + { | |
| 216 | + $this->categories = $categories; | |
| 217 | + | |
| 218 | + return $this; | |
| 219 | + } | |
| 220 | + | |
| 221 | + /** | |
| 222 | + * Checks whether custom categories have been specified. | |
| 223 | + * | |
| 224 | + * @return bool | |
| 225 | + * | |
| 226 | + * @since 1.8.8 | |
| 227 | + */ | |
| 228 | + public function hasCategories() | |
| 229 | + { | |
| 230 | + return (bool) $this->categories; | |
| 231 | + } | |
| 232 | + | |
| 233 | + /** | |
| 234 | + * Returns the specified categories, if any. | |
| 235 | + * | |
| 236 | + * @return string[] | |
| 237 | + * | |
| 238 | + * @since 1.8.8 | |
| 239 | + */ | |
| 240 | + public function getCategories() | |
| 241 | + { | |
| 242 | + return $this->categories; | |
| 243 | + } | |
| 244 | + | |
| 245 | + /** | |
| 190 | 246 | * Sets the specified message ID. |
| 191 | 247 | * |
| 192 | 248 | * @param int $messageId The ID of the message. |
| 193 | 249 | * @param string $operator Used to set the comparison operator. |
| @@ -321,9 +377,9 @@ | ||
| 321 | 377 | * @return self |
| 322 | 378 | */ |
| 323 | 379 | public function reader(?int $readerId) |
| 324 | 380 | { |
| 325 | - $this->readerId = is_null($readerId) ? null : abs($readerId); | |
| 381 | + $this->readerId = $readerId; | |
| 326 | 382 | |
| 327 | 383 | return $this; |
| 328 | 384 | } |
| 329 | 385 | |
| @@ -392,6 +448,46 @@ | ||
| 392 | 448 | */ |
| 393 | 449 | public function hasAggregate() |
| 394 | 450 | { |
| 395 | 451 | return $this->aggregate; |
| 452 | + } | |
| 453 | + | |
| 454 | + /** | |
| 455 | + * Sets the specified message reference ID. | |
| 456 | + * | |
| 457 | + * @param string|null $refId | |
| 458 | + * | |
| 459 | + * @return self | |
| 460 | + * | |
| 461 | + * @since 1.8.8 | |
| 462 | + */ | |
| 463 | + public function refId(?string $refId) | |
| 464 | + { | |
| 465 | + $this->refId = $refId; | |
| 466 | + | |
| 467 | + return $this; | |
| 468 | + } | |
| 469 | + | |
| 470 | + /** | |
| 471 | + * Checks whether a custom reference ID has been specified. | |
| 472 | + * | |
| 473 | + * @return bool | |
| 474 | + * | |
| 475 | + * @since 1.8.8 | |
| 476 | + */ | |
| 477 | + public function hasRefId() | |
| 478 | + { | |
| 479 | + return $this->refId !== null; | |
| 480 | + } | |
| 481 | + | |
| 482 | + /** | |
| 483 | + * Returns the specified reference ID. | |
| 484 | + * | |
| 485 | + * @return string|null | |
| 486 | + * | |
| 487 | + * @since 1.8.8 | |
| 488 | + */ | |
| 489 | + public function getRefId() | |
| 490 | + { | |
| 491 | + return $this->refId; | |
| 396 | 492 | } |
| 397 | 493 | } |