diff options
Diffstat (limited to 'lib/public/Activity/IEvent.php')
-rw-r--r-- | lib/public/Activity/IEvent.php | 104 |
1 files changed, 51 insertions, 53 deletions
diff --git a/lib/public/Activity/IEvent.php b/lib/public/Activity/IEvent.php index 1e3c1deef26..6014b75123c 100644 --- a/lib/public/Activity/IEvent.php +++ b/lib/public/Activity/IEvent.php @@ -3,33 +3,17 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Robin Appelman <robin@icewind.nl> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ // use OCP namespace for all classes that are considered public. -// This means that they should be used by apps instead of the internal ownCloud classes +// This means that they should be used by apps instead of the internal Nextcloud classes namespace OCP\Activity; +use OCP\Activity\Exceptions\InvalidValueException; + /** * Interface IEvent * @@ -41,8 +25,9 @@ interface IEvent { * * @param string $app * @return IEvent - * @throws \InvalidArgumentException if the app id is invalid + * @throws InvalidValueException if the app id is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setApp(string $app): self; @@ -51,28 +36,31 @@ interface IEvent { * * @param string $type * @return IEvent - * @throws \InvalidArgumentException if the type is invalid + * @throws InvalidValueException if the type is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setType(string $type): self; /** * Set the affected user of the activity * - * @param string $user + * @param string $affectedUser * @return IEvent - * @throws \InvalidArgumentException if the affected user is invalid + * @throws InvalidValueException if the affected user is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ - public function setAffectedUser(string $user): self; + public function setAffectedUser(string $affectedUser): self; /** * Set the author of the activity * * @param string $author * @return IEvent - * @throws \InvalidArgumentException if the author is invalid + * @throws InvalidValueException if the author is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setAuthor(string $author): self; @@ -81,8 +69,9 @@ interface IEvent { * * @param int $timestamp * @return IEvent - * @throws \InvalidArgumentException if the timestamp is invalid + * @throws InvalidValueException if the timestamp is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setTimestamp(int $timestamp): self; @@ -92,8 +81,9 @@ interface IEvent { * @param string $subject * @param array $parameters * @return IEvent - * @throws \InvalidArgumentException if the subject or parameters are invalid + * @throws InvalidValueException if the subject or parameters are invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setSubject(string $subject, array $parameters = []): self; @@ -103,16 +93,15 @@ interface IEvent { * HTML is not allowed in the parsed subject and will be escaped * automatically by the clients. You can use the RichObjectString system * provided by the Nextcloud server to highlight important parameters via - * the setRichSubject method, but make sure, that a plain text message is - * always set via setParsedSubject, to support clients which can not handle - * rich strings. + * the setRichSubject method. * * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $subject * @return $this - * @throws \InvalidArgumentException if the subject is invalid + * @throws InvalidValueException if the subject is invalid * @since 11.0.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setParsedSubject(string $subject): self; @@ -128,16 +117,15 @@ interface IEvent { * HTML is not allowed in the rich subject and will be escaped automatically * by the clients, but you can use the RichObjectString system provided by * the Nextcloud server to highlight important parameters. - * Also make sure, that a plain text subject is always set via - * setParsedSubject, to support clients which can not handle rich strings. * * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $subject - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this - * @throws \InvalidArgumentException if the subject or parameters are invalid + * @throws InvalidValueException if the subject or parameters are invalid * @since 11.0.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setRichSubject(string $subject, array $parameters = []): self; @@ -148,7 +136,7 @@ interface IEvent { public function getRichSubject(): string; /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichSubjectParameters(): array; @@ -159,8 +147,9 @@ interface IEvent { * @param string $message * @param array $parameters * @return IEvent - * @throws \InvalidArgumentException if the message or parameters are invalid + * @throws InvalidValueException if the message or parameters are invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setMessage(string $message, array $parameters = []): self; @@ -170,16 +159,15 @@ interface IEvent { * HTML is not allowed in the parsed message and will be escaped * automatically by the clients. You can use the RichObjectString system * provided by the Nextcloud server to highlight important parameters via - * the setRichMessage method, but make sure, that a plain text message is - * always set via setParsedMessage, to support clients which can not handle - * rich strings. + * the setRichMessage method. * * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $message * @return $this - * @throws \InvalidArgumentException if the message is invalid + * @throws InvalidValueException if the message is invalid * @since 11.0.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setParsedMessage(string $message): self; @@ -195,16 +183,15 @@ interface IEvent { * HTML is not allowed in the rich message and will be escaped automatically * by the clients, but you can use the RichObjectString system provided by * the Nextcloud server to highlight important parameters. - * Also make sure, that a plain text message is always set via - * setParsedMessage, to support clients which can not handle rich strings. * * See https://github.com/nextcloud/server/issues/1706 for more information. * * @param string $message - * @param array $parameters + * @param array<string, array<string, string>> $parameters * @return $this * @throws \InvalidArgumentException if the message or parameters are invalid * @since 11.0.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setRichMessage(string $message, array $parameters = []): self; @@ -215,7 +202,7 @@ interface IEvent { public function getRichMessage(): string; /** - * @return array[] + * @return array<string, array<string, string>> * @since 11.0.0 */ public function getRichMessageParameters(): array; @@ -227,8 +214,9 @@ interface IEvent { * @param int $objectId * @param string $objectName * @return IEvent - * @throws \InvalidArgumentException if the object is invalid + * @throws InvalidValueException if the object is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setObject(string $objectType, int $objectId, string $objectName = ''): self; @@ -237,8 +225,9 @@ interface IEvent { * * @param string $link * @return IEvent - * @throws \InvalidArgumentException if the link is invalid + * @throws InvalidValueException if the link is invalid * @since 8.2.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setLink(string $link): self; @@ -321,14 +310,23 @@ interface IEvent { public function getLink(): string; /** + * Set the absolute url for the icon (should be colored black or not have a color) + * + * It's automatically color inverted by clients when needed + * * @param string $icon * @return $this - * @throws \InvalidArgumentException if the icon is invalid + * @throws InvalidValueException if the icon is invalid * @since 11.0.0 + * @since 30.0.0 throws {@see InvalidValueException} instead of \InvalidArgumentException */ public function setIcon(string $icon): self; /** + * Get the absolute url for the icon (should be colored black or not have a color) + * + * It's automatically color inverted by clients when needed + * * @return string * @since 11.0.0 */ @@ -360,7 +358,7 @@ interface IEvent { public function isValidParsed(): bool; /** - * Set whether or not a notification should be automatically generated for this activity. + * Set whether a notification should be automatically generated for this activity. * * Set this to `false` if the app already generates a notification for the event. * @@ -371,7 +369,7 @@ interface IEvent { public function setGenerateNotification(bool $generate): self; /** - * whether or not a notification should be automatically generated for this activity. + * Whether a notification should be automatically generated for this activity. * * @return bool * @since 20.0.0 |