diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-08 14:42:48 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-14 13:25:54 +0200 |
commit | 575dc29c276fdd792e04375be5c2d4f249a4bec3 (patch) | |
tree | 266fa77780669becd6acbc3bfd029de4dcddf29d /lib | |
parent | 95592ff65c68a167cc8da6bfea022f3e3e2d25f7 (diff) | |
download | nextcloud-server-575dc29c276fdd792e04375be5c2d4f249a4bec3.tar.gz nextcloud-server-575dc29c276fdd792e04375be5c2d4f249a4bec3.zip |
Make Appdata static
* Add fileid for simpleroot folders (only internal)
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/AppData/AppData.php | 16 | ||||
-rw-r--r-- | lib/private/Files/AppData/Factory.php | 3 | ||||
-rw-r--r-- | lib/public/Files/SimpleFS/ISimpleRoot.php | 6 |
3 files changed, 16 insertions, 9 deletions
diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index 270e834b8e5..e25bf450446 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright 2016 Roeland Jago Douma <roeland@famdouma.nl> * @@ -31,6 +32,7 @@ use OC\SystemConfig; use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; +use OCP\Files\SimpleFS\ISimpleFolder; class AppData implements IAppData { @@ -55,7 +57,7 @@ class AppData implements IAppData { */ public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig, - $appId) { + string $appId) { $this->rootFolder = $rootFolder; $this->config = $systemConfig; @@ -66,7 +68,7 @@ class AppData implements IAppData { * @return Folder * @throws \RuntimeException */ - private function getAppDataFolder() { + private function getAppDataFolder(): Folder { if ($this->folder === null) { $instanceId = $this->config->getValue('instanceid', null); if ($instanceId === null) { @@ -101,20 +103,20 @@ class AppData implements IAppData { return $this->folder; } - public function getFolder($name) { + public function getFolder(string $name): ISimpleFolder { $node = $this->getAppDataFolder()->get($name); /** @var Folder $node */ return new SimpleFolder($node); } - public function newFolder($name) { + public function newFolder(string $name): ISimpleFolder { $folder = $this->getAppDataFolder()->newFolder($name); return new SimpleFolder($folder); } - public function getDirectoryListing() { + public function getDirectoryListing(): array { $listing = $this->getAppDataFolder()->getDirectoryListing(); $fileListing = array_map(function(Node $folder) { @@ -128,4 +130,8 @@ class AppData implements IAppData { return array_values($fileListing); } + + public function getId(): int { + return $this->getAppDataFolder()->getId(); + } } diff --git a/lib/private/Files/AppData/Factory.php b/lib/private/Files/AppData/Factory.php index 85c75733796..fba2232db06 100644 --- a/lib/private/Files/AppData/Factory.php +++ b/lib/private/Files/AppData/Factory.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright 2016 Roeland Jago Douma <roeland@famdouma.nl> * @@ -44,7 +45,7 @@ class Factory { * @param string $appId * @return AppData */ - public function get($appId) { + public function get(string $appId): AppData { return new AppData($this->rootFolder, $this->config, $appId); } } diff --git a/lib/public/Files/SimpleFS/ISimpleRoot.php b/lib/public/Files/SimpleFS/ISimpleRoot.php index 9b4b8d76947..054106fbaca 100644 --- a/lib/public/Files/SimpleFS/ISimpleRoot.php +++ b/lib/public/Files/SimpleFS/ISimpleRoot.php @@ -42,7 +42,7 @@ interface ISimpleRoot { * @throws \RuntimeException * @since 11.0.0 */ - public function getFolder($name); + public function getFolder(string $name): ISimpleFolder; /** * Get all the Folders @@ -52,7 +52,7 @@ interface ISimpleRoot { * @throws \RuntimeException * @since 11.0.0 */ - public function getDirectoryListing(); + public function getDirectoryListing(): array; /** * Create a new folder named $name @@ -63,5 +63,5 @@ interface ISimpleRoot { * @throws \RuntimeException * @since 11.0.0 */ - public function newFolder($name); + public function newFolder(string $name): ISimpleFolder; } |