Completed
Push — master ( a23d52...d867f9 )
by Morris
48:45 queued 13s
created
apps/files_trashbin/appinfo/routes.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 
27 27
 $application = new Application();
28 28
 $application->registerRoutes($this, [
29
-	'routes' => [
30
-		[
31
-			'name' => 'Preview#getPreview',
32
-			'url' => '/preview',
33
-			'verb' => 'GET',
34
-		],
35
-	],
29
+    'routes' => [
30
+        [
31
+            'name' => 'Preview#getPreview',
32
+            'url' => '/preview',
33
+            'verb' => 'GET',
34
+        ],
35
+    ],
36 36
 ]);
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/ITrash.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@
 block discarded – undo
26 26
 use OCP\Files\FileInfo;
27 27
 
28 28
 interface ITrash {
29
-	public function restore(): bool;
29
+    public function restore(): bool;
30 30
 
31
-	public function getFilename(): string;
31
+    public function getFilename(): string;
32 32
 
33
-	public function getOriginalLocation(): string;
33
+    public function getOriginalLocation(): string;
34 34
 
35
-	public function getDeletionTime(): int;
35
+    public function getDeletionTime(): int;
36 36
 
37
-	public function getSize();
37
+    public function getSize();
38 38
 
39
-	public function getFileId(): int;
39
+    public function getFileId(): int;
40 40
 
41
-	public function getFileInfo(): FileInfo;
41
+    public function getFileInfo(): FileInfo;
42 42
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFolderFolder.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -30,86 +30,86 @@
 block discarded – undo
30 30
 
31 31
 class TrashFolderFolder extends AbstractTrash implements ICollection, ITrash {
32 32
 
33
-	/** @var string */
34
-	private $root;
35
-
36
-	/** @var string */
37
-	private $userId;
38
-
39
-	/** @var string */
40
-	private $location;
41
-
42
-	public function __construct(string $root,
43
-								string $userId,
44
-								FileInfo $data,
45
-								string $location) {
46
-		$this->root = $root;
47
-		$this->userId = $userId;
48
-		$this->location = $location;
49
-		parent::__construct($data);
50
-	}
51
-
52
-	public function createFile($name, $data = null) {
53
-		throw new Forbidden();
54
-	}
55
-
56
-	public function createDirectory($name) {
57
-		throw new Forbidden();
58
-	}
59
-
60
-	public function getChild($name): ITrash {
61
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
62
-
63
-		foreach ($entries as $entry) {
64
-			if ($entry->getName() === $name) {
65
-				if ($entry->getType() === FileInfo::TYPE_FOLDER) {
66
-					return new TrashFolderFolder($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
67
-				}
68
-				return new TrashFolderFile($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
69
-			}
70
-		}
71
-
72
-		throw new NotFound();
73
-	}
74
-
75
-	public function getChildren(): array {
76
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
77
-
78
-		$children = array_map(function (FileInfo $entry) {
79
-			if ($entry->getType() === FileInfo::TYPE_FOLDER) {
80
-				return new TrashFolderFolder($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
81
-			}
82
-			return new TrashFolderFile($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
83
-		}, $entries);
84
-
85
-		return $children;
86
-	}
87
-
88
-	public function childExists($name): bool {
89
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
90
-
91
-		foreach ($entries as $entry) {
92
-			if ($entry->getName() === $name) {
93
-				return true;
94
-			}
95
-		}
96
-
97
-		return false;
98
-	}
99
-
100
-	public function delete() {
101
-		\OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
102
-	}
103
-
104
-	public function setName($name) {
105
-		throw new Forbidden();
106
-	}
107
-
108
-	public function restore(): bool {
109
-		return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
110
-	}
111
-
112
-	public function getOriginalLocation(): string {
113
-		return $this->location . '/' . $this->getFilename();
114
-	}
33
+    /** @var string */
34
+    private $root;
35
+
36
+    /** @var string */
37
+    private $userId;
38
+
39
+    /** @var string */
40
+    private $location;
41
+
42
+    public function __construct(string $root,
43
+                                string $userId,
44
+                                FileInfo $data,
45
+                                string $location) {
46
+        $this->root = $root;
47
+        $this->userId = $userId;
48
+        $this->location = $location;
49
+        parent::__construct($data);
50
+    }
51
+
52
+    public function createFile($name, $data = null) {
53
+        throw new Forbidden();
54
+    }
55
+
56
+    public function createDirectory($name) {
57
+        throw new Forbidden();
58
+    }
59
+
60
+    public function getChild($name): ITrash {
61
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
62
+
63
+        foreach ($entries as $entry) {
64
+            if ($entry->getName() === $name) {
65
+                if ($entry->getType() === FileInfo::TYPE_FOLDER) {
66
+                    return new TrashFolderFolder($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
67
+                }
68
+                return new TrashFolderFile($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
69
+            }
70
+        }
71
+
72
+        throw new NotFound();
73
+    }
74
+
75
+    public function getChildren(): array {
76
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
77
+
78
+        $children = array_map(function (FileInfo $entry) {
79
+            if ($entry->getType() === FileInfo::TYPE_FOLDER) {
80
+                return new TrashFolderFolder($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
81
+            }
82
+            return new TrashFolderFile($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
83
+        }, $entries);
84
+
85
+        return $children;
86
+    }
87
+
88
+    public function childExists($name): bool {
89
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
90
+
91
+        foreach ($entries as $entry) {
92
+            if ($entry->getName() === $name) {
93
+                return true;
94
+            }
95
+        }
96
+
97
+        return false;
98
+    }
99
+
100
+    public function delete() {
101
+        \OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
102
+    }
103
+
104
+    public function setName($name) {
105
+        throw new Forbidden();
106
+    }
107
+
108
+    public function restore(): bool {
109
+        return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
110
+    }
111
+
112
+    public function getOriginalLocation(): string {
113
+        return $this->location . '/' . $this->getFilename();
114
+    }
115 115
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	public function getChild($name): ITrash {
61
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
61
+		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root.'/'.$this->getName(), $this->userId);
62 62
 
63 63
 		foreach ($entries as $entry) {
64 64
 			if ($entry->getName() === $name) {
65 65
 				if ($entry->getType() === FileInfo::TYPE_FOLDER) {
66
-					return new TrashFolderFolder($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
66
+					return new TrashFolderFolder($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
67 67
 				}
68
-				return new TrashFolderFile($this->root . '/' . $this->getName(), $this->userId, $entry, $this->getOriginalLocation());
68
+				return new TrashFolderFile($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
69 69
 			}
70 70
 		}
71 71
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	public function getChildren(): array {
76
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
76
+		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root.'/'.$this->getName(), $this->userId);
77 77
 
78
-		$children = array_map(function (FileInfo $entry) {
78
+		$children = array_map(function(FileInfo $entry) {
79 79
 			if ($entry->getType() === FileInfo::TYPE_FOLDER) {
80 80
 				return new TrashFolderFolder($this->root.'/'.$this->getName(), $this->userId, $entry, $this->getOriginalLocation());
81 81
 			}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	public function childExists($name): bool {
89
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root . '/' . $this->getName(), $this->userId);
89
+		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->root.'/'.$this->getName(), $this->userId);
90 90
 
91 91
 		foreach ($entries as $entry) {
92 92
 			if ($entry->getName() === $name) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	public function delete() {
101
-		\OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
101
+		\OCA\Files_Trashbin\Trashbin::delete($this->root.'/'.$this->getName(), $this->userId, null);
102 102
 	}
103 103
 
104 104
 	public function setName($name) {
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 	public function restore(): bool {
109
-		return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
109
+		return \OCA\Files_Trashbin\Trashbin::restore($this->root.'/'.$this->getName(), $this->data->getName(), null);
110 110
 	}
111 111
 
112 112
 	public function getOriginalLocation(): string {
113
-		return $this->location . '/' . $this->getFilename();
113
+		return $this->location.'/'.$this->getFilename();
114 114
 	}
115 115
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/AbstractTrash.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,46 +24,46 @@
 block discarded – undo
24 24
 use OCP\Files\FileInfo;
25 25
 
26 26
 abstract class AbstractTrash implements ITrash {
27
-	/** @var FileInfo */
28
-	protected $data;
27
+    /** @var FileInfo */
28
+    protected $data;
29 29
 
30
-	public function __construct(FileInfo $data) {
31
-		$this->data = $data;
32
-	}
30
+    public function __construct(FileInfo $data) {
31
+        $this->data = $data;
32
+    }
33 33
 
34
-	public function getFilename(): string {
35
-		return $this->data->getName();
36
-	}
34
+    public function getFilename(): string {
35
+        return $this->data->getName();
36
+    }
37 37
 
38
-	public function getDeletionTime(): int {
39
-		return $this->data->getMtime();
40
-	}
38
+    public function getDeletionTime(): int {
39
+        return $this->data->getMtime();
40
+    }
41 41
 
42
-	public function getFileId(): int {
43
-		return $this->data->getId();
44
-	}
42
+    public function getFileId(): int {
43
+        return $this->data->getId();
44
+    }
45 45
 
46
-	public function getFileInfo(): FileInfo {
47
-		return $this->data;
48
-	}
46
+    public function getFileInfo(): FileInfo {
47
+        return $this->data;
48
+    }
49 49
 
50
-	public function getSize(): int {
51
-		return $this->data->getSize();
52
-	}
50
+    public function getSize(): int {
51
+        return $this->data->getSize();
52
+    }
53 53
 
54
-	public function getLastModified(): int {
55
-		return $this->data->getMtime();
56
-	}
54
+    public function getLastModified(): int {
55
+        return $this->data->getMtime();
56
+    }
57 57
 
58
-	public function getContentType(): string {
59
-		return $this->data->getMimetype();
60
-	}
58
+    public function getContentType(): string {
59
+        return $this->data->getMimetype();
60
+    }
61 61
 
62
-	public function getETag(): string {
63
-		return $this->data->getEtag();
64
-	}
62
+    public function getETag(): string {
63
+        return $this->data->getEtag();
64
+    }
65 65
 
66
-	public function getName(): string {
67
-		return $this->data->getName();
68
-	}
66
+    public function getName(): string {
67
+        return $this->data->getName();
68
+    }
69 69
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFolderFile.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,46 +28,46 @@
 block discarded – undo
28 28
 use Sabre\DAV\IFile;
29 29
 
30 30
 class TrashFolderFile extends AbstractTrash implements IFile, ITrash {
31
-	/** @var string */
32
-	private $root;
31
+    /** @var string */
32
+    private $root;
33 33
 
34
-	/** @var string */
35
-	private $userId;
34
+    /** @var string */
35
+    private $userId;
36 36
 
37
-	/** @var string */
38
-	private $location;
37
+    /** @var string */
38
+    private $location;
39 39
 
40
-	public function __construct(string $root,
41
-								string $userId,
42
-								FileInfo $data,
43
-								string $location) {
44
-		$this->root = $root;
45
-		$this->userId = $userId;
46
-		$this->location = $location;
47
-		parent::__construct($data);
48
-	}
40
+    public function __construct(string $root,
41
+                                string $userId,
42
+                                FileInfo $data,
43
+                                string $location) {
44
+        $this->root = $root;
45
+        $this->userId = $userId;
46
+        $this->location = $location;
47
+        parent::__construct($data);
48
+    }
49 49
 
50
-	public function put($data) {
51
-		throw new Forbidden();
52
-	}
50
+    public function put($data) {
51
+        throw new Forbidden();
52
+    }
53 53
 
54
-	public function get() {
55
-		return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
56
-	}
54
+    public function get() {
55
+        return $this->data->getStorage()->fopen($this->data->getInternalPath(), 'rb');
56
+    }
57 57
 
58
-	public function delete() {
59
-		\OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
60
-	}
58
+    public function delete() {
59
+        \OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
60
+    }
61 61
 
62
-	public function setName($name) {
63
-		throw new Forbidden();
64
-	}
62
+    public function setName($name) {
63
+        throw new Forbidden();
64
+    }
65 65
 
66
-	public function restore(): bool {
67
-		return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
68
-	}
66
+    public function restore(): bool {
67
+        return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
68
+    }
69 69
 
70
-	public function getOriginalLocation(): string {
71
-		return $this->location . '/' . $this->getFilename();
72
-	}
70
+    public function getOriginalLocation(): string {
71
+        return $this->location . '/' . $this->getFilename();
72
+    }
73 73
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	public function delete() {
59
-		\OCA\Files_Trashbin\Trashbin::delete($this->root . '/' . $this->getName(), $this->userId, null);
59
+		\OCA\Files_Trashbin\Trashbin::delete($this->root.'/'.$this->getName(), $this->userId, null);
60 60
 	}
61 61
 
62 62
 	public function setName($name) {
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	}
65 65
 
66 66
 	public function restore(): bool {
67
-		return \OCA\Files_Trashbin\Trashbin::restore($this->root . '/' . $this->getName(), $this->data->getName(), null);
67
+		return \OCA\Files_Trashbin\Trashbin::restore($this->root.'/'.$this->getName(), $this->data->getName(), null);
68 68
 	}
69 69
 
70 70
 	public function getOriginalLocation(): string {
71
-		return $this->location . '/' . $this->getFilename();
71
+		return $this->location.'/'.$this->getFilename();
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFile.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -28,39 +28,39 @@
 block discarded – undo
28 28
 use Sabre\DAV\IFile;
29 29
 
30 30
 class TrashFile extends AbstractTrash implements IFile, ITrash {
31
-	/** @var string */
32
-	private $userId;
31
+    /** @var string */
32
+    private $userId;
33 33
 
34
-	public function __construct(string $userId, FileInfo $data) {
35
-		$this->userId = $userId;
36
-		parent::__construct($data);
37
-	}
34
+    public function __construct(string $userId, FileInfo $data) {
35
+        $this->userId = $userId;
36
+        parent::__construct($data);
37
+    }
38 38
 
39
-	public function put($data) {
40
-		throw new Forbidden();
41
-	}
39
+    public function put($data) {
40
+        throw new Forbidden();
41
+    }
42 42
 
43
-	public function get() {
44
-		return $this->data->getStorage()->fopen($this->data->getInternalPath().'.d'.$this->getLastModified(), 'rb');
45
-	}
43
+    public function get() {
44
+        return $this->data->getStorage()->fopen($this->data->getInternalPath().'.d'.$this->getLastModified(), 'rb');
45
+    }
46 46
 
47
-	public function delete() {
48
-		\OCA\Files_Trashbin\Trashbin::delete($this->data->getName(), $this->userId, $this->getLastModified());
49
-	}
47
+    public function delete() {
48
+        \OCA\Files_Trashbin\Trashbin::delete($this->data->getName(), $this->userId, $this->getLastModified());
49
+    }
50 50
 
51
-	public function getName(): string {
52
-		return $this->data->getName() . '.d' . $this->getLastModified();
53
-	}
51
+    public function getName(): string {
52
+        return $this->data->getName() . '.d' . $this->getLastModified();
53
+    }
54 54
 
55
-	public function setName($name) {
56
-		throw new Forbidden();
57
-	}
55
+    public function setName($name) {
56
+        throw new Forbidden();
57
+    }
58 58
 
59
-	public function restore(): bool {
60
-		return \OCA\Files_Trashbin\Trashbin::restore($this->getName(), $this->data->getName(), $this->getLastModified());
61
-	}
59
+    public function restore(): bool {
60
+        return \OCA\Files_Trashbin\Trashbin::restore($this->getName(), $this->data->getName(), $this->getLastModified());
61
+    }
62 62
 
63
-	public function getOriginalLocation(): string {
64
-		return $this->data['extraData'];
65
-	}
63
+    public function getOriginalLocation(): string {
64
+        return $this->data['extraData'];
65
+    }
66 66
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/TrashFolder.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -29,79 +29,79 @@
 block discarded – undo
29 29
 use Sabre\DAV\ICollection;
30 30
 
31 31
 class TrashFolder extends AbstractTrash implements ICollection, ITrash {
32
-	/** @var string */
33
-	private $userId;
34
-
35
-	public function __construct(string $root, string $userId, FileInfo $data) {
36
-		$this->userId = $userId;
37
-		parent::__construct($data);
38
-	}
39
-
40
-	public function createFile($name, $data = null) {
41
-		throw new Forbidden();
42
-	}
43
-
44
-	public function createDirectory($name) {
45
-		throw new Forbidden();
46
-	}
47
-
48
-	public function getChild($name): ITrash {
49
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
50
-
51
-		foreach ($entries as $entry) {
52
-			if ($entry->getName() === $name) {
53
-				if ($entry->getType() === FileInfo::TYPE_FOLDER) {
54
-					return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
55
-				}
56
-				return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
57
-			}
58
-		}
59
-
60
-		throw new NotFound();
61
-	}
62
-
63
-	public function getChildren(): array {
64
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
65
-
66
-		$children = array_map(function (FileInfo $entry) {
67
-			if ($entry->getType() === FileInfo::TYPE_FOLDER) {
68
-				return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
69
-			}
70
-			return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
71
-		}, $entries);
72
-
73
-		return $children;
74
-	}
75
-
76
-	public function childExists($name): bool {
77
-		$entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
78
-
79
-		foreach ($entries as $entry) {
80
-			if ($entry->getName() === $name) {
81
-				return true;
82
-			}
83
-		}
84
-
85
-		return false;
86
-	}
87
-
88
-	public function delete() {
89
-		\OCA\Files_Trashbin\Trashbin::delete($this->data->getName(), $this->userId, $this->getLastModified());
90
-	}
91
-
92
-	public function getName(): string {
93
-		return $this->data->getName() . '.d' . $this->getLastModified();
94
-	}
95
-
96
-	public function setName($name) {
97
-		throw new Forbidden();
98
-	}
99
-
100
-	public function restore(): bool {
101
-		return \OCA\Files_Trashbin\Trashbin::restore($this->getName(), $this->data->getName(), $this->getLastModified());
102
-	}
103
-
104
-	public function getOriginalLocation(): string {
105
-		return $this->data['extraData'];
106
-	}
32
+    /** @var string */
33
+    private $userId;
34
+
35
+    public function __construct(string $root, string $userId, FileInfo $data) {
36
+        $this->userId = $userId;
37
+        parent::__construct($data);
38
+    }
39
+
40
+    public function createFile($name, $data = null) {
41
+        throw new Forbidden();
42
+    }
43
+
44
+    public function createDirectory($name) {
45
+        throw new Forbidden();
46
+    }
47
+
48
+    public function getChild($name): ITrash {
49
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
50
+
51
+        foreach ($entries as $entry) {
52
+            if ($entry->getName() === $name) {
53
+                if ($entry->getType() === FileInfo::TYPE_FOLDER) {
54
+                    return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
55
+                }
56
+                return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
57
+            }
58
+        }
59
+
60
+        throw new NotFound();
61
+    }
62
+
63
+    public function getChildren(): array {
64
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
65
+
66
+        $children = array_map(function (FileInfo $entry) {
67
+            if ($entry->getType() === FileInfo::TYPE_FOLDER) {
68
+                return new TrashFolderFolder($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
69
+            }
70
+            return new TrashFolderFile($this->getName(), $this->userId, $entry, $this->getOriginalLocation());
71
+        }, $entries);
72
+
73
+        return $children;
74
+    }
75
+
76
+    public function childExists($name): bool {
77
+        $entries = \OCA\Files_Trashbin\Helper::getTrashFiles($this->getName(), $this->userId);
78
+
79
+        foreach ($entries as $entry) {
80
+            if ($entry->getName() === $name) {
81
+                return true;
82
+            }
83
+        }
84
+
85
+        return false;
86
+    }
87
+
88
+    public function delete() {
89
+        \OCA\Files_Trashbin\Trashbin::delete($this->data->getName(), $this->userId, $this->getLastModified());
90
+    }
91
+
92
+    public function getName(): string {
93
+        return $this->data->getName() . '.d' . $this->getLastModified();
94
+    }
95
+
96
+    public function setName($name) {
97
+        throw new Forbidden();
98
+    }
99
+
100
+    public function restore(): bool {
101
+        return \OCA\Files_Trashbin\Trashbin::restore($this->getName(), $this->data->getName(), $this->getLastModified());
102
+    }
103
+
104
+    public function getOriginalLocation(): string {
105
+        return $this->data['extraData'];
106
+    }
107 107
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Sabre/PropfindPlugin.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -34,75 +34,75 @@
 block discarded – undo
34 34
 
35 35
 class PropfindPlugin extends ServerPlugin {
36 36
 
37
-	const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
38
-	const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
39
-	const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
37
+    const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
38
+    const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location';
39
+    const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time';
40 40
 
41
-	/** @var Server */
42
-	private $server;
41
+    /** @var Server */
42
+    private $server;
43 43
 
44
-	/** @var IPreview */
45
-	private $previewManager;
44
+    /** @var IPreview */
45
+    private $previewManager;
46 46
 
47
-	public function __construct(
48
-		IPreview $previewManager
49
-	) {
50
-		$this->previewManager = $previewManager;
51
-	}
47
+    public function __construct(
48
+        IPreview $previewManager
49
+    ) {
50
+        $this->previewManager = $previewManager;
51
+    }
52 52
 
53
-	public function initialize(Server $server) {
54
-		$this->server = $server;
53
+    public function initialize(Server $server) {
54
+        $this->server = $server;
55 55
 
56
-		$this->server->on('propFind', [$this, 'propFind']);
57
-	}
56
+        $this->server->on('propFind', [$this, 'propFind']);
57
+    }
58 58
 
59 59
 
60
-	public function propFind(PropFind $propFind, INode $node) {
61
-		if (!($node instanceof ITrash)) {
62
-			return;
63
-		}
60
+    public function propFind(PropFind $propFind, INode $node) {
61
+        if (!($node instanceof ITrash)) {
62
+            return;
63
+        }
64 64
 
65
-		$propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
66
-			return $node->getFilename();
67
-		});
65
+        $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
66
+            return $node->getFilename();
67
+        });
68 68
 
69
-		$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
70
-			return $node->getOriginalLocation();
71
-		});
69
+        $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
70
+            return $node->getOriginalLocation();
71
+        });
72 72
 
73
-		$propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
74
-			return $node->getDeletionTime();
75
-		});
73
+        $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
74
+            return $node->getDeletionTime();
75
+        });
76 76
 
77
-		$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
78
-			return $node->getSize();
79
-		});
77
+        $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
78
+            return $node->getSize();
79
+        });
80 80
 
81
-		$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
82
-			return $node->getFileId();
83
-		});
81
+        $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
82
+            return $node->getFileId();
83
+        });
84 84
 
85
-		$propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
86
-			return 'GD'; // read + delete
87
-		});
85
+        $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
86
+            return 'GD'; // read + delete
87
+        });
88 88
 
89
-		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
90
-			// add fake etag, it is only needed to identify the preview image
91
-			return $node->getLastModified();
92
-		});
89
+        $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
90
+            // add fake etag, it is only needed to identify the preview image
91
+            return $node->getLastModified();
92
+        });
93 93
 
94
-		$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
95
-			// add fake etag, it is only needed to identify the preview image
96
-			return $node->getFileId();
97
-		});
94
+        $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
95
+            // add fake etag, it is only needed to identify the preview image
96
+            return $node->getFileId();
97
+        });
98 98
 
99
-		$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
100
-			return $this->previewManager->isAvailable($node->getFileInfo());
101
-		});
99
+        $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
100
+            return $this->previewManager->isAvailable($node->getFileInfo());
101
+        });
102 102
 
103
-		$propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
104
-			return '';
105
-		});
106
-	}
103
+        $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
104
+            return '';
105
+        });
106
+    }
107 107
 
108 108
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -62,45 +62,45 @@
 block discarded – undo
62 62
 			return;
63 63
 		}
64 64
 
65
-		$propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) {
65
+		$propFind->handle(self::TRASHBIN_FILENAME, function() use ($node) {
66 66
 			return $node->getFilename();
67 67
 		});
68 68
 
69
-		$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) {
69
+		$propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function() use ($node) {
70 70
 			return $node->getOriginalLocation();
71 71
 		});
72 72
 
73
-		$propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) {
73
+		$propFind->handle(self::TRASHBIN_DELETION_TIME, function() use ($node) {
74 74
 			return $node->getDeletionTime();
75 75
 		});
76 76
 
77
-		$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) {
77
+		$propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function() use ($node) {
78 78
 			return $node->getSize();
79 79
 		});
80 80
 
81
-		$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) {
81
+		$propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function() use ($node) {
82 82
 			return $node->getFileId();
83 83
 		});
84 84
 
85
-		$propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () {
85
+		$propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function() {
86 86
 			return 'GD'; // read + delete
87 87
 		});
88 88
 
89
-		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) {
89
+		$propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function() use ($node) {
90 90
 			// add fake etag, it is only needed to identify the preview image
91 91
 			return $node->getLastModified();
92 92
 		});
93 93
 
94
-		$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) {
94
+		$propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) {
95 95
 			// add fake etag, it is only needed to identify the preview image
96 96
 			return $node->getFileId();
97 97
 		});
98 98
 
99
-		$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) {
99
+		$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function() use ($node) {
100 100
 			return $this->previewManager->isAvailable($node->getFileInfo());
101 101
 		});
102 102
 
103
-		$propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () {
103
+		$propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function() {
104 104
 			return '';
105 105
 		});
106 106
 	}
Please login to merge, or discard this patch.
apps/files_trashbin/composer/composer/autoload_static.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,51 +6,51 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitFiles_Trashbin
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\Files_Trashbin\\' => 19,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\Files_Trashbin\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'OCA\\Files_Trashbin\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
25
-        'OCA\\Files_Trashbin\\BackgroundJob\\ExpireTrash' => __DIR__ . '/..' . '/../lib/BackgroundJob/ExpireTrash.php',
26
-        'OCA\\Files_Trashbin\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
27
-        'OCA\\Files_Trashbin\\Command\\CleanUp' => __DIR__ . '/..' . '/../lib/Command/CleanUp.php',
28
-        'OCA\\Files_Trashbin\\Command\\Expire' => __DIR__ . '/..' . '/../lib/Command/Expire.php',
29
-        'OCA\\Files_Trashbin\\Command\\ExpireTrash' => __DIR__ . '/..' . '/../lib/Command/ExpireTrash.php',
30
-        'OCA\\Files_Trashbin\\Controller\\PreviewController' => __DIR__ . '/..' . '/../lib/Controller/PreviewController.php',
31
-        'OCA\\Files_Trashbin\\Events\\MoveToTrashEvent' => __DIR__ . '/..' . '/../lib/Events/MoveToTrashEvent.php',
32
-        'OCA\\Files_Trashbin\\Exceptions\\CopyRecursiveException' => __DIR__ . '/..' . '/../lib/Exceptions/CopyRecursiveException.php',
33
-        'OCA\\Files_Trashbin\\Expiration' => __DIR__ . '/..' . '/../lib/Expiration.php',
34
-        'OCA\\Files_Trashbin\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
35
-        'OCA\\Files_Trashbin\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php',
36
-        'OCA\\Files_Trashbin\\Sabre\\AbstractTrash' => __DIR__ . '/..' . '/../lib/Sabre/AbstractTrash.php',
37
-        'OCA\\Files_Trashbin\\Sabre\\ITrash' => __DIR__ . '/..' . '/../lib/Sabre/ITrash.php',
38
-        'OCA\\Files_Trashbin\\Sabre\\PropfindPlugin' => __DIR__ . '/..' . '/../lib/Sabre/PropfindPlugin.php',
39
-        'OCA\\Files_Trashbin\\Sabre\\RestoreFolder' => __DIR__ . '/..' . '/../lib/Sabre/RestoreFolder.php',
40
-        'OCA\\Files_Trashbin\\Sabre\\RootCollection' => __DIR__ . '/..' . '/../lib/Sabre/RootCollection.php',
41
-        'OCA\\Files_Trashbin\\Sabre\\TrashFile' => __DIR__ . '/..' . '/../lib/Sabre/TrashFile.php',
42
-        'OCA\\Files_Trashbin\\Sabre\\TrashFolder' => __DIR__ . '/..' . '/../lib/Sabre/TrashFolder.php',
43
-        'OCA\\Files_Trashbin\\Sabre\\TrashFolderFile' => __DIR__ . '/..' . '/../lib/Sabre/TrashFolderFile.php',
44
-        'OCA\\Files_Trashbin\\Sabre\\TrashFolderFolder' => __DIR__ . '/..' . '/../lib/Sabre/TrashFolderFolder.php',
45
-        'OCA\\Files_Trashbin\\Sabre\\TrashHome' => __DIR__ . '/..' . '/../lib/Sabre/TrashHome.php',
46
-        'OCA\\Files_Trashbin\\Sabre\\TrashRoot' => __DIR__ . '/..' . '/../lib/Sabre/TrashRoot.php',
47
-        'OCA\\Files_Trashbin\\Storage' => __DIR__ . '/..' . '/../lib/Storage.php',
48
-        'OCA\\Files_Trashbin\\Trashbin' => __DIR__ . '/..' . '/../lib/Trashbin.php',
23
+    public static $classMap = array(
24
+        'OCA\\Files_Trashbin\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
25
+        'OCA\\Files_Trashbin\\BackgroundJob\\ExpireTrash' => __DIR__.'/..'.'/../lib/BackgroundJob/ExpireTrash.php',
26
+        'OCA\\Files_Trashbin\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php',
27
+        'OCA\\Files_Trashbin\\Command\\CleanUp' => __DIR__.'/..'.'/../lib/Command/CleanUp.php',
28
+        'OCA\\Files_Trashbin\\Command\\Expire' => __DIR__.'/..'.'/../lib/Command/Expire.php',
29
+        'OCA\\Files_Trashbin\\Command\\ExpireTrash' => __DIR__.'/..'.'/../lib/Command/ExpireTrash.php',
30
+        'OCA\\Files_Trashbin\\Controller\\PreviewController' => __DIR__.'/..'.'/../lib/Controller/PreviewController.php',
31
+        'OCA\\Files_Trashbin\\Events\\MoveToTrashEvent' => __DIR__.'/..'.'/../lib/Events/MoveToTrashEvent.php',
32
+        'OCA\\Files_Trashbin\\Exceptions\\CopyRecursiveException' => __DIR__.'/..'.'/../lib/Exceptions/CopyRecursiveException.php',
33
+        'OCA\\Files_Trashbin\\Expiration' => __DIR__.'/..'.'/../lib/Expiration.php',
34
+        'OCA\\Files_Trashbin\\Helper' => __DIR__.'/..'.'/../lib/Helper.php',
35
+        'OCA\\Files_Trashbin\\Hooks' => __DIR__.'/..'.'/../lib/Hooks.php',
36
+        'OCA\\Files_Trashbin\\Sabre\\AbstractTrash' => __DIR__.'/..'.'/../lib/Sabre/AbstractTrash.php',
37
+        'OCA\\Files_Trashbin\\Sabre\\ITrash' => __DIR__.'/..'.'/../lib/Sabre/ITrash.php',
38
+        'OCA\\Files_Trashbin\\Sabre\\PropfindPlugin' => __DIR__.'/..'.'/../lib/Sabre/PropfindPlugin.php',
39
+        'OCA\\Files_Trashbin\\Sabre\\RestoreFolder' => __DIR__.'/..'.'/../lib/Sabre/RestoreFolder.php',
40
+        'OCA\\Files_Trashbin\\Sabre\\RootCollection' => __DIR__.'/..'.'/../lib/Sabre/RootCollection.php',
41
+        'OCA\\Files_Trashbin\\Sabre\\TrashFile' => __DIR__.'/..'.'/../lib/Sabre/TrashFile.php',
42
+        'OCA\\Files_Trashbin\\Sabre\\TrashFolder' => __DIR__.'/..'.'/../lib/Sabre/TrashFolder.php',
43
+        'OCA\\Files_Trashbin\\Sabre\\TrashFolderFile' => __DIR__.'/..'.'/../lib/Sabre/TrashFolderFile.php',
44
+        'OCA\\Files_Trashbin\\Sabre\\TrashFolderFolder' => __DIR__.'/..'.'/../lib/Sabre/TrashFolderFolder.php',
45
+        'OCA\\Files_Trashbin\\Sabre\\TrashHome' => __DIR__.'/..'.'/../lib/Sabre/TrashHome.php',
46
+        'OCA\\Files_Trashbin\\Sabre\\TrashRoot' => __DIR__.'/..'.'/../lib/Sabre/TrashRoot.php',
47
+        'OCA\\Files_Trashbin\\Storage' => __DIR__.'/..'.'/../lib/Storage.php',
48
+        'OCA\\Files_Trashbin\\Trashbin' => __DIR__.'/..'.'/../lib/Trashbin.php',
49 49
     );
50 50
 
51 51
     public static function getInitializer(ClassLoader $loader)
52 52
     {
53
-        return \Closure::bind(function () use ($loader) {
53
+        return \Closure::bind(function() use ($loader) {
54 54
             $loader->prefixLengthsPsr4 = ComposerStaticInitFiles_Trashbin::$prefixLengthsPsr4;
55 55
             $loader->prefixDirsPsr4 = ComposerStaticInitFiles_Trashbin::$prefixDirsPsr4;
56 56
             $loader->classMap = ComposerStaticInitFiles_Trashbin::$classMap;
Please login to merge, or discard this patch.