diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index 270e834b8e..e25bf45044 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -1,4 +1,5 @@ * @@ -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 85c7573379..fba2232db0 100644 --- a/lib/private/Files/AppData/Factory.php +++ b/lib/private/Files/AppData/Factory.php @@ -1,4 +1,5 @@ * @@ -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 9b4b8d7694..054106fbac 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; }