From bd27eadf9e14335efdd4a537269ad2f5b49efc14 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 18 May 2016 18:21:27 +0200 Subject: Move \OCP\Notification to PSR-4 --- lib/public/Notification/IAction.php | 105 ++++++++++++++ lib/public/Notification/IApp.php | 52 +++++++ lib/public/Notification/IManager.php | 66 +++++++++ lib/public/Notification/INotification.php | 223 ++++++++++++++++++++++++++++++ lib/public/Notification/INotifier.php | 39 ++++++ lib/public/notification/iaction.php | 105 -------------- lib/public/notification/iapp.php | 52 ------- lib/public/notification/imanager.php | 66 --------- lib/public/notification/inotification.php | 223 ------------------------------ lib/public/notification/inotifier.php | 39 ------ 10 files changed, 485 insertions(+), 485 deletions(-) create mode 100644 lib/public/Notification/IAction.php create mode 100644 lib/public/Notification/IApp.php create mode 100644 lib/public/Notification/IManager.php create mode 100644 lib/public/Notification/INotification.php create mode 100644 lib/public/Notification/INotifier.php delete mode 100644 lib/public/notification/iaction.php delete mode 100644 lib/public/notification/iapp.php delete mode 100644 lib/public/notification/imanager.php delete mode 100644 lib/public/notification/inotification.php delete mode 100644 lib/public/notification/inotifier.php diff --git a/lib/public/Notification/IAction.php b/lib/public/Notification/IAction.php new file mode 100644 index 00000000000..1f4d1d5b7fe --- /dev/null +++ b/lib/public/Notification/IAction.php @@ -0,0 +1,105 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @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 + * + */ + +namespace OCP\Notification; + +/** + * Interface IAction + * + * @package OCP\Notification + * @since 9.0.0 + */ +interface IAction { + /** + * @param string $label + * @return $this + * @throws \InvalidArgumentException if the label is invalid + * @since 9.0.0 + */ + public function setLabel($label); + + /** + * @return string + * @since 9.0.0 + */ + public function getLabel(); + + /** + * @param string $label + * @return $this + * @throws \InvalidArgumentException if the label is invalid + * @since 9.0.0 + */ + public function setParsedLabel($label); + + /** + * @return string + * @since 9.0.0 + */ + public function getParsedLabel(); + + /** + * @param $primary bool + * @return $this + * @throws \InvalidArgumentException if $primary is invalid + * @since 9.0.0 + */ + public function setPrimary($primary); + + /** + * @return bool + * @since 9.0.0 + */ + public function isPrimary(); + + /** + * @param string $link + * @param string $requestType + * @return $this + * @throws \InvalidArgumentException if the link is invalid + * @since 9.0.0 + */ + public function setLink($link, $requestType); + + /** + * @return string + * @since 9.0.0 + */ + public function getLink(); + + /** + * @return string + * @since 9.0.0 + */ + public function getRequestType(); + + /** + * @return bool + * @since 9.0.0 + */ + public function isValid(); + + /** + * @return bool + * @since 9.0.0 + */ + public function isValidParsed(); +} diff --git a/lib/public/Notification/IApp.php b/lib/public/Notification/IApp.php new file mode 100644 index 00000000000..98da265559b --- /dev/null +++ b/lib/public/Notification/IApp.php @@ -0,0 +1,52 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @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 + * + */ + +namespace OCP\Notification; + +/** + * Interface IApp + * + * @package OCP\Notification + * @since 9.0.0 + */ +interface IApp { + /** + * @param INotification $notification + * @return null + * @throws \InvalidArgumentException When the notification is not valid + * @since 9.0.0 + */ + public function notify(INotification $notification); + + /** + * @param INotification $notification + * @return null + * @since 9.0.0 + */ + public function markProcessed(INotification $notification); + + /** + * @param INotification $notification + * @return int + * @since 9.0.0 + */ + public function getCount(INotification $notification); +} diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php new file mode 100644 index 00000000000..a18af747b10 --- /dev/null +++ b/lib/public/Notification/IManager.php @@ -0,0 +1,66 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @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 + * + */ + +namespace OCP\Notification; + +/** + * Interface IManager + * + * @package OCP\Notification + * @since 9.0.0 + */ +interface IManager extends IApp, INotifier { + /** + * @param \Closure $service The service must implement IApp, otherwise a + * \InvalidArgumentException is thrown later + * @return null + * @since 9.0.0 + */ + public function registerApp(\Closure $service); + + /** + * @param \Closure $service The service must implement INotifier, otherwise a + * \InvalidArgumentException is thrown later + * @param \Closure $info An array with the keys 'id' and 'name' containing + * the app id and the app name + * @return null + * @since 9.0.0 + */ + public function registerNotifier(\Closure $service, \Closure $info); + + /** + * @return array App ID => App Name + * @since 9.0.0 + */ + public function listNotifiers(); + + /** + * @return INotification + * @since 9.0.0 + */ + public function createNotification(); + + /** + * @return bool + * @since 9.0.0 + */ + public function hasNotifiers(); +} diff --git a/lib/public/Notification/INotification.php b/lib/public/Notification/INotification.php new file mode 100644 index 00000000000..2d8557ec64d --- /dev/null +++ b/lib/public/Notification/INotification.php @@ -0,0 +1,223 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @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 + * + */ + +namespace OCP\Notification; + +/** + * Interface INotification + * + * @package OCP\Notification + * @since 9.0.0 + */ +interface INotification { + /** + * @param string $app + * @return $this + * @throws \InvalidArgumentException if the app id are invalid + * @since 9.0.0 + */ + public function setApp($app); + + /** + * @return string + * @since 9.0.0 + */ + public function getApp(); + + /** + * @param string $user + * @return $this + * @throws \InvalidArgumentException if the user id are invalid + * @since 9.0.0 + */ + public function setUser($user); + + /** + * @return string + * @since 9.0.0 + */ + public function getUser(); + + /** + * @param \DateTime $dateTime + * @return $this + * @throws \InvalidArgumentException if the $dateTime is invalid + * @since 9.0.0 + */ + public function setDateTime(\DateTime $dateTime); + + /** + * @return \DateTime + * @since 9.0.0 + */ + public function getDateTime(); + + /** + * @param string $type + * @param string $id + * @return $this + * @throws \InvalidArgumentException if the object type or id is invalid + * @since 9.0.0 + */ + public function setObject($type, $id); + + /** + * @return string + * @since 9.0.0 + */ + public function getObjectType(); + + /** + * @return string + * @since 9.0.0 + */ + public function getObjectId(); + + /** + * @param string $subject + * @param array $parameters + * @return $this + * @throws \InvalidArgumentException if the subject or parameters are invalid + * @since 9.0.0 + */ + public function setSubject($subject, array $parameters = []); + + /** + * @return string + * @since 9.0.0 + */ + public function getSubject(); + + /** + * @return string[] + * @since 9.0.0 + */ + public function getSubjectParameters(); + + /** + * @param string $subject + * @return $this + * @throws \InvalidArgumentException if the subject are invalid + * @since 9.0.0 + */ + public function setParsedSubject($subject); + + /** + * @return string + * @since 9.0.0 + */ + public function getParsedSubject(); + + /** + * @param string $message + * @param array $parameters + * @return $this + * @throws \InvalidArgumentException if the message or parameters are invalid + * @since 9.0.0 + */ + public function setMessage($message, array $parameters = []); + + /** + * @return string + * @since 9.0.0 + */ + public function getMessage(); + + /** + * @return string[] + * @since 9.0.0 + */ + public function getMessageParameters(); + + /** + * @param string $message + * @return $this + * @throws \InvalidArgumentException if the message are invalid + * @since 9.0.0 + */ + public function setParsedMessage($message); + + /** + * @return string + * @since 9.0.0 + */ + public function getParsedMessage(); + + /** + * @param string $link + * @return $this + * @throws \InvalidArgumentException if the link are invalid + * @since 9.0.0 + */ + public function setLink($link); + + /** + * @return string + * @since 9.0.0 + */ + public function getLink(); + + /** + * @return IAction + * @since 9.0.0 + */ + public function createAction(); + + /** + * @param IAction $action + * @return $this + * @throws \InvalidArgumentException if the action are invalid + * @since 9.0.0 + */ + public function addAction(IAction $action); + + /** + * @return IAction[] + * @since 9.0.0 + */ + public function getActions(); + + /** + * @param IAction $action + * @return $this + * @throws \InvalidArgumentException if the action are invalid + * @since 9.0.0 + */ + public function addParsedAction(IAction $action); + + /** + * @return IAction[] + * @since 9.0.0 + */ + public function getParsedActions(); + + /** + * @return bool + * @since 9.0.0 + */ + public function isValid(); + + /** + * @return bool + * @since 9.0.0 + */ + public function isValidParsed(); +} diff --git a/lib/public/Notification/INotifier.php b/lib/public/Notification/INotifier.php new file mode 100644 index 00000000000..0d9cecc88b8 --- /dev/null +++ b/lib/public/Notification/INotifier.php @@ -0,0 +1,39 @@ + + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @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 + * + */ + +namespace OCP\Notification; + +/** + * Interface INotifier + * + * @package OCP\Notification + * @since 9.0.0 + */ +interface INotifier { + /** + * @param INotification $notification + * @param string $languageCode The code of the language that should be used to prepare the notification + * @return INotification + * @throws \InvalidArgumentException When the notification was not prepared by a notifier + * @since 9.0.0 + */ + public function prepare(INotification $notification, $languageCode); +} diff --git a/lib/public/notification/iaction.php b/lib/public/notification/iaction.php deleted file mode 100644 index 1f4d1d5b7fe..00000000000 --- a/lib/public/notification/iaction.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @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 - * - */ - -namespace OCP\Notification; - -/** - * Interface IAction - * - * @package OCP\Notification - * @since 9.0.0 - */ -interface IAction { - /** - * @param string $label - * @return $this - * @throws \InvalidArgumentException if the label is invalid - * @since 9.0.0 - */ - public function setLabel($label); - - /** - * @return string - * @since 9.0.0 - */ - public function getLabel(); - - /** - * @param string $label - * @return $this - * @throws \InvalidArgumentException if the label is invalid - * @since 9.0.0 - */ - public function setParsedLabel($label); - - /** - * @return string - * @since 9.0.0 - */ - public function getParsedLabel(); - - /** - * @param $primary bool - * @return $this - * @throws \InvalidArgumentException if $primary is invalid - * @since 9.0.0 - */ - public function setPrimary($primary); - - /** - * @return bool - * @since 9.0.0 - */ - public function isPrimary(); - - /** - * @param string $link - * @param string $requestType - * @return $this - * @throws \InvalidArgumentException if the link is invalid - * @since 9.0.0 - */ - public function setLink($link, $requestType); - - /** - * @return string - * @since 9.0.0 - */ - public function getLink(); - - /** - * @return string - * @since 9.0.0 - */ - public function getRequestType(); - - /** - * @return bool - * @since 9.0.0 - */ - public function isValid(); - - /** - * @return bool - * @since 9.0.0 - */ - public function isValidParsed(); -} diff --git a/lib/public/notification/iapp.php b/lib/public/notification/iapp.php deleted file mode 100644 index 98da265559b..00000000000 --- a/lib/public/notification/iapp.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @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 - * - */ - -namespace OCP\Notification; - -/** - * Interface IApp - * - * @package OCP\Notification - * @since 9.0.0 - */ -interface IApp { - /** - * @param INotification $notification - * @return null - * @throws \InvalidArgumentException When the notification is not valid - * @since 9.0.0 - */ - public function notify(INotification $notification); - - /** - * @param INotification $notification - * @return null - * @since 9.0.0 - */ - public function markProcessed(INotification $notification); - - /** - * @param INotification $notification - * @return int - * @since 9.0.0 - */ - public function getCount(INotification $notification); -} diff --git a/lib/public/notification/imanager.php b/lib/public/notification/imanager.php deleted file mode 100644 index a18af747b10..00000000000 --- a/lib/public/notification/imanager.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @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 - * - */ - -namespace OCP\Notification; - -/** - * Interface IManager - * - * @package OCP\Notification - * @since 9.0.0 - */ -interface IManager extends IApp, INotifier { - /** - * @param \Closure $service The service must implement IApp, otherwise a - * \InvalidArgumentException is thrown later - * @return null - * @since 9.0.0 - */ - public function registerApp(\Closure $service); - - /** - * @param \Closure $service The service must implement INotifier, otherwise a - * \InvalidArgumentException is thrown later - * @param \Closure $info An array with the keys 'id' and 'name' containing - * the app id and the app name - * @return null - * @since 9.0.0 - */ - public function registerNotifier(\Closure $service, \Closure $info); - - /** - * @return array App ID => App Name - * @since 9.0.0 - */ - public function listNotifiers(); - - /** - * @return INotification - * @since 9.0.0 - */ - public function createNotification(); - - /** - * @return bool - * @since 9.0.0 - */ - public function hasNotifiers(); -} diff --git a/lib/public/notification/inotification.php b/lib/public/notification/inotification.php deleted file mode 100644 index 2d8557ec64d..00000000000 --- a/lib/public/notification/inotification.php +++ /dev/null @@ -1,223 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @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 - * - */ - -namespace OCP\Notification; - -/** - * Interface INotification - * - * @package OCP\Notification - * @since 9.0.0 - */ -interface INotification { - /** - * @param string $app - * @return $this - * @throws \InvalidArgumentException if the app id are invalid - * @since 9.0.0 - */ - public function setApp($app); - - /** - * @return string - * @since 9.0.0 - */ - public function getApp(); - - /** - * @param string $user - * @return $this - * @throws \InvalidArgumentException if the user id are invalid - * @since 9.0.0 - */ - public function setUser($user); - - /** - * @return string - * @since 9.0.0 - */ - public function getUser(); - - /** - * @param \DateTime $dateTime - * @return $this - * @throws \InvalidArgumentException if the $dateTime is invalid - * @since 9.0.0 - */ - public function setDateTime(\DateTime $dateTime); - - /** - * @return \DateTime - * @since 9.0.0 - */ - public function getDateTime(); - - /** - * @param string $type - * @param string $id - * @return $this - * @throws \InvalidArgumentException if the object type or id is invalid - * @since 9.0.0 - */ - public function setObject($type, $id); - - /** - * @return string - * @since 9.0.0 - */ - public function getObjectType(); - - /** - * @return string - * @since 9.0.0 - */ - public function getObjectId(); - - /** - * @param string $subject - * @param array $parameters - * @return $this - * @throws \InvalidArgumentException if the subject or parameters are invalid - * @since 9.0.0 - */ - public function setSubject($subject, array $parameters = []); - - /** - * @return string - * @since 9.0.0 - */ - public function getSubject(); - - /** - * @return string[] - * @since 9.0.0 - */ - public function getSubjectParameters(); - - /** - * @param string $subject - * @return $this - * @throws \InvalidArgumentException if the subject are invalid - * @since 9.0.0 - */ - public function setParsedSubject($subject); - - /** - * @return string - * @since 9.0.0 - */ - public function getParsedSubject(); - - /** - * @param string $message - * @param array $parameters - * @return $this - * @throws \InvalidArgumentException if the message or parameters are invalid - * @since 9.0.0 - */ - public function setMessage($message, array $parameters = []); - - /** - * @return string - * @since 9.0.0 - */ - public function getMessage(); - - /** - * @return string[] - * @since 9.0.0 - */ - public function getMessageParameters(); - - /** - * @param string $message - * @return $this - * @throws \InvalidArgumentException if the message are invalid - * @since 9.0.0 - */ - public function setParsedMessage($message); - - /** - * @return string - * @since 9.0.0 - */ - public function getParsedMessage(); - - /** - * @param string $link - * @return $this - * @throws \InvalidArgumentException if the link are invalid - * @since 9.0.0 - */ - public function setLink($link); - - /** - * @return string - * @since 9.0.0 - */ - public function getLink(); - - /** - * @return IAction - * @since 9.0.0 - */ - public function createAction(); - - /** - * @param IAction $action - * @return $this - * @throws \InvalidArgumentException if the action are invalid - * @since 9.0.0 - */ - public function addAction(IAction $action); - - /** - * @return IAction[] - * @since 9.0.0 - */ - public function getActions(); - - /** - * @param IAction $action - * @return $this - * @throws \InvalidArgumentException if the action are invalid - * @since 9.0.0 - */ - public function addParsedAction(IAction $action); - - /** - * @return IAction[] - * @since 9.0.0 - */ - public function getParsedActions(); - - /** - * @return bool - * @since 9.0.0 - */ - public function isValid(); - - /** - * @return bool - * @since 9.0.0 - */ - public function isValidParsed(); -} diff --git a/lib/public/notification/inotifier.php b/lib/public/notification/inotifier.php deleted file mode 100644 index 0d9cecc88b8..00000000000 --- a/lib/public/notification/inotifier.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @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 - * - */ - -namespace OCP\Notification; - -/** - * Interface INotifier - * - * @package OCP\Notification - * @since 9.0.0 - */ -interface INotifier { - /** - * @param INotification $notification - * @param string $languageCode The code of the language that should be used to prepare the notification - * @return INotification - * @throws \InvalidArgumentException When the notification was not prepared by a notifier - * @since 9.0.0 - */ - public function prepare(INotification $notification, $languageCode); -} -- cgit v1.2.3