diff options
author | Joas Schilling <coding@schilljs.com> | 2019-04-10 14:12:10 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-07-15 15:12:40 +0200 |
commit | 9b288cda6daf0ab82a910b3442fcc0e003471741 (patch) | |
tree | 9f20504c3eed2f5ca1a63bf135dea47943b100e6 /lib/public/Notification | |
parent | c048c56411d86a3f8509ddae66743d4f189f2deb (diff) | |
download | nextcloud-server-9b288cda6daf0ab82a910b3442fcc0e003471741.tar.gz nextcloud-server-9b288cda6daf0ab82a910b3442fcc0e003471741.zip |
Make all interfaces strict
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/public/Notification')
-rw-r--r-- | lib/public/Notification/IAction.php | 47 | ||||
-rw-r--r-- | lib/public/Notification/IApp.php | 7 | ||||
-rw-r--r-- | lib/public/Notification/IManager.php | 11 | ||||
-rw-r--r-- | lib/public/Notification/INotification.php | 78 | ||||
-rw-r--r-- | lib/public/Notification/INotifier.php | 3 |
5 files changed, 86 insertions, 60 deletions
diff --git a/lib/public/Notification/IAction.php b/lib/public/Notification/IAction.php index 6f2b78e3a8d..718a61b2f39 100644 --- a/lib/public/Notification/IAction.php +++ b/lib/public/Notification/IAction.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -29,19 +30,41 @@ namespace OCP\Notification; * @since 9.0.0 */ interface IAction { + + /** + * @since 17.0.0 + */ + public const TYPE_GET = 'GET'; + /** + * @since 17.0.0 + */ + public const TYPE_POST = 'POST'; + /** + * @since 17.0.0 + */ + public const TYPE_PUT = 'PUT'; + /** + * @since 17.0.0 + */ + public const TYPE_DELETE = 'DELETE'; + /** + * @since 17.0.0 + */ + public const TYPE_WEB = 'WEB'; + /** * @param string $label * @return $this * @throws \InvalidArgumentException if the label is invalid * @since 9.0.0 */ - public function setLabel($label); + public function setLabel(string $label): IAction; /** * @return string * @since 9.0.0 */ - public function getLabel(); + public function getLabel(): string; /** * @param string $label @@ -49,27 +72,27 @@ interface IAction { * @throws \InvalidArgumentException if the label is invalid * @since 9.0.0 */ - public function setParsedLabel($label); + public function setParsedLabel(string $label): IAction; /** * @return string * @since 9.0.0 */ - public function getParsedLabel(); + public function getParsedLabel(): string; /** - * @param $primary bool + * @param bool $primary * @return $this * @throws \InvalidArgumentException if $primary is invalid * @since 9.0.0 */ - public function setPrimary($primary); + public function setPrimary(bool $primary): IAction; /** * @return bool * @since 9.0.0 */ - public function isPrimary(); + public function isPrimary(): bool; /** * @param string $link @@ -78,29 +101,29 @@ interface IAction { * @throws \InvalidArgumentException if the link is invalid * @since 9.0.0 */ - public function setLink($link, $requestType); + public function setLink(string $link, string $requestType): IAction; /** * @return string * @since 9.0.0 */ - public function getLink(); + public function getLink(): string; /** * @return string * @since 9.0.0 */ - public function getRequestType(); + public function getRequestType(): string; /** * @return bool * @since 9.0.0 */ - public function isValid(); + public function isValid(): bool; /** * @return bool * @since 9.0.0 */ - public function isValidParsed(); + public function isValidParsed(): bool; } diff --git a/lib/public/Notification/IApp.php b/lib/public/Notification/IApp.php index 8f7b9b3d013..58d2a1fa5b8 100644 --- a/lib/public/Notification/IApp.php +++ b/lib/public/Notification/IApp.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -34,18 +35,18 @@ interface IApp { * @throws \InvalidArgumentException When the notification is not valid * @since 9.0.0 */ - public function notify(INotification $notification); + public function notify(INotification $notification): void; /** * @param INotification $notification * @since 9.0.0 */ - public function markProcessed(INotification $notification); + public function markProcessed(INotification $notification): void; /** * @param INotification $notification * @return int * @since 9.0.0 */ - public function getCount(INotification $notification); + public function getCount(INotification $notification): int; } diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php index 003e5f1bad1..7feac76a5dc 100644 --- a/lib/public/Notification/IManager.php +++ b/lib/public/Notification/IManager.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -49,29 +50,29 @@ interface IManager extends IApp, INotifier { * @return array App ID => App Name * @since 9.0.0 */ - public function listNotifiers(); + public function listNotifiers(): array; /** * @return INotification * @since 9.0.0 */ - public function createNotification(); + public function createNotification(): INotification; /** * @return bool * @since 9.0.0 */ - public function hasNotifiers(); + public function hasNotifiers(): bool; /** * @param bool $preparingPushNotification * @since 14.0.0 */ - public function setPreparingPushNotification($preparingPushNotification); + public function setPreparingPushNotification(bool $preparingPushNotification): void; /** * @return bool * @since 14.0.0 */ - public function isPreparingPushNotification(); + public function isPreparingPushNotification(): bool; } diff --git a/lib/public/Notification/INotification.php b/lib/public/Notification/INotification.php index f7400e4778b..7261409e355 100644 --- a/lib/public/Notification/INotification.php +++ b/lib/public/Notification/INotification.php @@ -1,5 +1,5 @@ <?php -declare (strict_types = 1); +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -37,13 +37,13 @@ interface INotification { * @throws \InvalidArgumentException if the app id is invalid * @since 9.0.0 */ - public function setApp(string $app); + public function setApp(string $app): INotification; /** * @return string * @since 9.0.0 */ - public function getApp(); + public function getApp(): string; /** * @param string $user @@ -51,13 +51,13 @@ interface INotification { * @throws \InvalidArgumentException if the user id is invalid * @since 9.0.0 */ - public function setUser(string $user); + public function setUser(string $user): INotification; /** * @return string * @since 9.0.0 */ - public function getUser(); + public function getUser(): string; /** * @param \DateTime $dateTime @@ -65,13 +65,13 @@ interface INotification { * @throws \InvalidArgumentException if the $dateTime is invalid * @since 9.0.0 */ - public function setDateTime(\DateTime $dateTime); + public function setDateTime(\DateTime $dateTime): INotification; /** * @return \DateTime * @since 9.0.0 */ - public function getDateTime(); + public function getDateTime(): \DateTime; /** * @param string $type @@ -80,19 +80,19 @@ interface INotification { * @throws \InvalidArgumentException if the object type or id is invalid * @since 9.0.0 */ - public function setObject(string $type, $id); + public function setObject(string $type, string $id): INotification; /** * @return string * @since 9.0.0 */ - public function getObjectType(); + public function getObjectType(): string; /** * @return string * @since 9.0.0 */ - public function getObjectId(); + public function getObjectId(): string; /** * @param string $subject @@ -101,19 +101,19 @@ interface INotification { * @throws \InvalidArgumentException if the subject or parameters are invalid * @since 9.0.0 */ - public function setSubject(string $subject, array $parameters = []); + public function setSubject(string $subject, array $parameters = []): INotification; /** * @return string * @since 9.0.0 */ - public function getSubject(); + public function getSubject(): string; /** - * @return string[] + * @return array * @since 9.0.0 */ - public function getSubjectParameters(); + public function getSubjectParameters(): array; /** * Set a parsed subject @@ -132,13 +132,13 @@ interface INotification { * @throws \InvalidArgumentException if the subject is invalid * @since 9.0.0 */ - public function setParsedSubject(string $subject); + public function setParsedSubject(string $subject): INotification; /** * @return string * @since 9.0.0 */ - public function getParsedSubject(); + public function getParsedSubject(): string; /** * Set a RichObjectString subject @@ -157,19 +157,19 @@ interface INotification { * @throws \InvalidArgumentException if the subject or parameters are invalid * @since 11.0.0 */ - public function setRichSubject(string $subject, array $parameters = []); + public function setRichSubject(string $subject, array $parameters = []): INotification; /** * @return string * @since 11.0.0 */ - public function getRichSubject(); + public function getRichSubject(): string; /** * @return array[] * @since 11.0.0 */ - public function getRichSubjectParameters(); + public function getRichSubjectParameters(): array; /** * @param string $message @@ -178,19 +178,19 @@ interface INotification { * @throws \InvalidArgumentException if the message or parameters are invalid * @since 9.0.0 */ - public function setMessage(string $message, array $parameters = []); + public function setMessage(string $message, array $parameters = []): INotification; /** * @return string * @since 9.0.0 */ - public function getMessage(); + public function getMessage(): string; /** - * @return string[] + * @return array * @since 9.0.0 */ - public function getMessageParameters(); + public function getMessageParameters(): array; /** * Set a parsed message @@ -209,13 +209,13 @@ interface INotification { * @throws \InvalidArgumentException if the message is invalid * @since 9.0.0 */ - public function setParsedMessage(string $message); + public function setParsedMessage(string $message): INotification; /** * @return string * @since 9.0.0 */ - public function getParsedMessage(); + public function getParsedMessage(): string; /** * Set a RichObjectString message @@ -234,19 +234,19 @@ interface INotification { * @throws \InvalidArgumentException if the message or parameters are invalid * @since 11.0.0 */ - public function setRichMessage(string $message, array $parameters = []); + public function setRichMessage(string $message, array $parameters = []): INotification; /** * @return string * @since 11.0.0 */ - public function getRichMessage(); + public function getRichMessage(): string; /** * @return array[] * @since 11.0.0 */ - public function getRichMessageParameters(); + public function getRichMessageParameters(): array; /** * @param string $link @@ -254,13 +254,13 @@ interface INotification { * @throws \InvalidArgumentException if the link is invalid * @since 9.0.0 */ - public function setLink(string $link); + public function setLink(string $link): INotification; /** * @return string * @since 9.0.0 */ - public function getLink(); + public function getLink(): string; /** * @param string $icon @@ -268,19 +268,19 @@ interface INotification { * @throws \InvalidArgumentException if the icon is invalid * @since 11.0.0 */ - public function setIcon(string $icon); + public function setIcon(string $icon): INotification; /** * @return string * @since 11.0.0 */ - public function getIcon(); + public function getIcon(): string; /** * @return IAction * @since 9.0.0 */ - public function createAction(); + public function createAction(): IAction; /** * @param IAction $action @@ -288,13 +288,13 @@ interface INotification { * @throws \InvalidArgumentException if the action is invalid * @since 9.0.0 */ - public function addAction(IAction $action); + public function addAction(IAction $action): INotification; /** * @return IAction[] * @since 9.0.0 */ - public function getActions(); + public function getActions(): array; /** * @param IAction $action @@ -302,23 +302,23 @@ interface INotification { * @throws \InvalidArgumentException if the action is invalid * @since 9.0.0 */ - public function addParsedAction(IAction $action); + public function addParsedAction(IAction $action): INotification; /** * @return IAction[] * @since 9.0.0 */ - public function getParsedActions(); + public function getParsedActions(): array; /** * @return bool * @since 9.0.0 */ - public function isValid(); + public function isValid(): bool; /** * @return bool * @since 9.0.0 */ - public function isValidParsed(); + public function isValidParsed(): bool; } diff --git a/lib/public/Notification/INotifier.php b/lib/public/Notification/INotifier.php index 5e2a47266ad..44066c035b9 100644 --- a/lib/public/Notification/INotifier.php +++ b/lib/public/Notification/INotifier.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -36,5 +37,5 @@ interface INotifier { * @throws \InvalidArgumentException When the notification was not prepared by a notifier * @since 9.0.0 */ - public function prepare(INotification $notification, $languageCode); + public function prepare(INotification $notification, string $languageCode): INotification; } |