summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Sabre/TrashFolder.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-04-25 20:24:23 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-04-25 20:25:10 +0200
commitc625fc5931c904e5d6bafe855429eebeae23467f (patch)
tree947d13b4afaf7254fcc0e842aa208324bea2f934 /apps/files_trashbin/lib/Sabre/TrashFolder.php
parentdadc740db5eb7a5641be842e10c283490fbf4c4d (diff)
downloadnextcloud-server-c625fc5931c904e5d6bafe855429eebeae23467f.tar.gz
nextcloud-server-c625fc5931c904e5d6bafe855429eebeae23467f.zip
Add folder for trashbin
The trashbin home now contains 2 entries restore and trash. Made all files strict. Added more types. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/TrashFolder.php')
-rw-r--r--apps/files_trashbin/lib/Sabre/TrashFolder.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/Sabre/TrashFolder.php b/apps/files_trashbin/lib/Sabre/TrashFolder.php
index 390f1956ffb..33236eea262 100644
--- a/apps/files_trashbin/lib/Sabre/TrashFolder.php
+++ b/apps/files_trashbin/lib/Sabre/TrashFolder.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2018, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -24,6 +25,7 @@ namespace OCA\Files_Trashbin\Sabre;
use OCP\Files\FileInfo;
use Sabre\DAV\Exception\Forbidden;
+use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\ICollection;
class TrashFolder implements ICollection, ITrash {
@@ -46,7 +48,7 @@ class TrashFolder implements ICollection, ITrash {
throw new Forbidden();
}
- public function getChild($name) {
+ public function getChild($name): ITrash {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
foreach ($entries as $entry) {
@@ -57,9 +59,11 @@ class TrashFolder implements ICollection, ITrash {
return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
}
}
+
+ throw new NotFound();
}
- public function getChildren() {
+ public function getChildren(): array {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
$children = array_map(function (FileInfo $entry) {
@@ -72,7 +76,7 @@ class TrashFolder implements ICollection, ITrash {
return $children;
}
- public function childExists($name) {
+ public function childExists($name): bool {
$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
foreach ($entries as $entry) {
@@ -88,7 +92,7 @@ class TrashFolder implements ICollection, ITrash {
\OCA\Files_Trashbin\Trashbin::delete($this->data->getName(), $this->userId, $this->getLastModified());
}
- public function getName() {
+ public function getName(): string {
return $this->data->getName() . '.d' . $this->getLastModified();
}
@@ -96,7 +100,7 @@ class TrashFolder implements ICollection, ITrash {
throw new Forbidden();
}
- public function getLastModified() {
+ public function getLastModified(): int {
return $this->data->getMtime();
}