diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-10-03 16:47:38 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-10-04 10:35:33 +0300 |
commit | f865a3a1c2405af5c649b6d78f95b93ed60ba04f (patch) | |
tree | c7194750f2c4c88be23b0cd4ec508a59d8b61d0b /lib/public/AppFramework | |
parent | eba83d22bbcf45caf400704b8794acce180c5ba9 (diff) |
Move initial state provider to boostrap
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public/AppFramework')
-rw-r--r-- | lib/public/AppFramework/Bootstrap/IRegistrationContext.php | 13 | ||||
-rw-r--r-- | lib/public/AppFramework/Services/InitialStateProvider.php | 49 |
2 files changed, 62 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 9d910d1c693..13181cbe1cb 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -155,4 +155,17 @@ interface IRegistrationContext { * @since 20.0.0 */ public function registerAlternativeLogin(string $class): void; + + /** + * Register an initialstate provider + * + * It is allowed to register more than one provider per app. + * + * @param string $class + * + * @return void + * + * @since 21.0.0 + */ + public function registerInitialStateProvider(string $class): void; } diff --git a/lib/public/AppFramework/Services/InitialStateProvider.php b/lib/public/AppFramework/Services/InitialStateProvider.php new file mode 100644 index 00000000000..53357b48825 --- /dev/null +++ b/lib/public/AppFramework/Services/InitialStateProvider.php @@ -0,0 +1,49 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\AppFramework\Services; + +/** + * @since 21.0.0 + */ +abstract class InitialStateProvider implements \JsonSerializable { + + /** + * @since 21.0.0 + */ + abstract public function getKey(): string; + + /** + * @since 21.0.0 + */ + abstract public function getData(); + + /** + * @since 21.0.0 + */ + final public function jsonSerialize() { + return $this->getData(); + } +} |