Passed
Push — master ( 76c318...963d96 )
by Morris
88:25 queued 74:01
created
lib/public/Files/File.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -39,69 +39,69 @@
 block discarded – undo
39 39
  * @since 6.0.0
40 40
  */
41 41
 interface File extends Node {
42
-	/**
43
-	 * Get the content of the file as string
44
-	 *
45
-	 * @return string
46
-	 * @throws \OCP\Files\NotPermittedException
47
-	 * @since 6.0.0
48
-	 */
49
-	public function getContent();
42
+    /**
43
+     * Get the content of the file as string
44
+     *
45
+     * @return string
46
+     * @throws \OCP\Files\NotPermittedException
47
+     * @since 6.0.0
48
+     */
49
+    public function getContent();
50 50
 
51
-	/**
52
-	 * Write to the file from string data
53
-	 *
54
-	 * @param string|resource $data
55
-	 * @throws \OCP\Files\NotPermittedException
56
-	 * @throws \OCP\Files\GenericFileException
57
-	 * @since 6.0.0
58
-	 */
59
-	public function putContent($data);
51
+    /**
52
+     * Write to the file from string data
53
+     *
54
+     * @param string|resource $data
55
+     * @throws \OCP\Files\NotPermittedException
56
+     * @throws \OCP\Files\GenericFileException
57
+     * @since 6.0.0
58
+     */
59
+    public function putContent($data);
60 60
 
61
-	/**
62
-	 * Get the mimetype of the file
63
-	 *
64
-	 * @return string
65
-	 * @since 6.0.0
66
-	 */
67
-	public function getMimeType();
61
+    /**
62
+     * Get the mimetype of the file
63
+     *
64
+     * @return string
65
+     * @since 6.0.0
66
+     */
67
+    public function getMimeType();
68 68
 
69
-	/**
70
-	 * Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
71
-	 *
72
-	 * @param string $mode
73
-	 * @return resource
74
-	 * @throws \OCP\Files\NotPermittedException
75
-	 * @since 6.0.0
76
-	 */
77
-	public function fopen($mode);
69
+    /**
70
+     * Open the file as stream, resulting resource can be operated as stream like the result from php's own fopen
71
+     *
72
+     * @param string $mode
73
+     * @return resource
74
+     * @throws \OCP\Files\NotPermittedException
75
+     * @since 6.0.0
76
+     */
77
+    public function fopen($mode);
78 78
 
79
-	/**
80
-	 * Compute the hash of the file
81
-	 * Type of hash is set with $type and can be anything supported by php's hash_file
82
-	 *
83
-	 * @param string $type
84
-	 * @param bool $raw
85
-	 * @return string
86
-	 * @since 6.0.0
87
-	 */
88
-	public function hash($type, $raw = false);
79
+    /**
80
+     * Compute the hash of the file
81
+     * Type of hash is set with $type and can be anything supported by php's hash_file
82
+     *
83
+     * @param string $type
84
+     * @param bool $raw
85
+     * @return string
86
+     * @since 6.0.0
87
+     */
88
+    public function hash($type, $raw = false);
89 89
 
90
-	/**
91
-	 * Get the stored checksum for this file
92
-	 *
93
-	 * @return string
94
-	 * @since 9.0.0
95
-	 * @throws InvalidPathException
96
-	 * @throws NotFoundException
97
-	 */
98
-	public function getChecksum();
90
+    /**
91
+     * Get the stored checksum for this file
92
+     *
93
+     * @return string
94
+     * @since 9.0.0
95
+     * @throws InvalidPathException
96
+     * @throws NotFoundException
97
+     */
98
+    public function getChecksum();
99 99
 
100
-	/**
101
-	 * Get the extension of this file
102
-	 *
103
-	 * @return string
104
-	 * @since 15.0.0
105
-	 */
106
-	public function getExtension(): string;
100
+    /**
101
+     * Get the extension of this file
102
+     *
103
+     * @return string
104
+     * @since 15.0.0
105
+     */
106
+    public function getExtension(): string;
107 107
 }
Please login to merge, or discard this patch.
lib/public/Files/FileInfo.php 1 patch
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -34,237 +34,237 @@
 block discarded – undo
34 34
  * @since 7.0.0
35 35
  */
36 36
 interface FileInfo {
37
-	/**
38
-	 * @since 7.0.0
39
-	 */
40
-	const TYPE_FILE = 'file';
41
-	/**
42
-	 * @since 7.0.0
43
-	 */
44
-	const TYPE_FOLDER = 'dir';
37
+    /**
38
+     * @since 7.0.0
39
+     */
40
+    const TYPE_FILE = 'file';
41
+    /**
42
+     * @since 7.0.0
43
+     */
44
+    const TYPE_FOLDER = 'dir';
45 45
 
46
-	/**
47
-	 * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
48
-	 * @since 8.0.0
49
-	 */
50
-	const SPACE_NOT_COMPUTED = -1;
51
-	/**
52
-	 * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
53
-	 * @since 8.0.0
54
-	 */
55
-	const SPACE_UNKNOWN = -2;
56
-	/**
57
-	 * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space
58
-	 * @since 8.0.0
59
-	 */
60
-	const SPACE_UNLIMITED = -3;
46
+    /**
47
+     * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
48
+     * @since 8.0.0
49
+     */
50
+    const SPACE_NOT_COMPUTED = -1;
51
+    /**
52
+     * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
53
+     * @since 8.0.0
54
+     */
55
+    const SPACE_UNKNOWN = -2;
56
+    /**
57
+     * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space
58
+     * @since 8.0.0
59
+     */
60
+    const SPACE_UNLIMITED = -3;
61 61
 
62
-	/**
63
-	 * @since 9.1.0
64
-	 */
65
-	const MIMETYPE_FOLDER = 'httpd/unix-directory';
62
+    /**
63
+     * @since 9.1.0
64
+     */
65
+    const MIMETYPE_FOLDER = 'httpd/unix-directory';
66 66
 
67
-	/**
68
-	 * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)
69
-	 * @since 12.0.0
70
-	 */
71
-	const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
67
+    /**
68
+     * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)
69
+     * @since 12.0.0
70
+     */
71
+    const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
72 72
 
73
-	/**
74
-	 * Get the Etag of the file or folder
75
-	 *
76
-	 * @return string
77
-	 * @since 7.0.0
78
-	 */
79
-	public function getEtag();
73
+    /**
74
+     * Get the Etag of the file or folder
75
+     *
76
+     * @return string
77
+     * @since 7.0.0
78
+     */
79
+    public function getEtag();
80 80
 
81
-	/**
82
-	 * Get the size in bytes for the file or folder
83
-	 *
84
-	 * @return int
85
-	 * @since 7.0.0
86
-	 */
87
-	public function getSize();
81
+    /**
82
+     * Get the size in bytes for the file or folder
83
+     *
84
+     * @return int
85
+     * @since 7.0.0
86
+     */
87
+    public function getSize();
88 88
 
89
-	/**
90
-	 * Get the last modified date as timestamp for the file or folder
91
-	 *
92
-	 * @return int
93
-	 * @since 7.0.0
94
-	 */
95
-	public function getMtime();
89
+    /**
90
+     * Get the last modified date as timestamp for the file or folder
91
+     *
92
+     * @return int
93
+     * @since 7.0.0
94
+     */
95
+    public function getMtime();
96 96
 
97
-	/**
98
-	 * Get the name of the file or folder
99
-	 *
100
-	 * @return string
101
-	 * @since 7.0.0
102
-	 */
103
-	public function getName();
97
+    /**
98
+     * Get the name of the file or folder
99
+     *
100
+     * @return string
101
+     * @since 7.0.0
102
+     */
103
+    public function getName();
104 104
 
105
-	/**
106
-	 * Get the path relative to the storage
107
-	 *
108
-	 * @return string
109
-	 * @since 7.0.0
110
-	 */
111
-	public function getInternalPath();
105
+    /**
106
+     * Get the path relative to the storage
107
+     *
108
+     * @return string
109
+     * @since 7.0.0
110
+     */
111
+    public function getInternalPath();
112 112
 
113
-	/**
114
-	 * Get the absolute path
115
-	 *
116
-	 * @return string
117
-	 * @since 7.0.0
118
-	 */
119
-	public function getPath();
113
+    /**
114
+     * Get the absolute path
115
+     *
116
+     * @return string
117
+     * @since 7.0.0
118
+     */
119
+    public function getPath();
120 120
 
121
-	/**
122
-	 * Get the full mimetype of the file or folder i.e. 'image/png'
123
-	 *
124
-	 * @return string
125
-	 * @since 7.0.0
126
-	 */
127
-	public function getMimetype();
121
+    /**
122
+     * Get the full mimetype of the file or folder i.e. 'image/png'
123
+     *
124
+     * @return string
125
+     * @since 7.0.0
126
+     */
127
+    public function getMimetype();
128 128
 
129
-	/**
130
-	 * Get the first part of the mimetype of the file or folder i.e. 'image'
131
-	 *
132
-	 * @return string
133
-	 * @since 7.0.0
134
-	 */
135
-	public function getMimePart();
129
+    /**
130
+     * Get the first part of the mimetype of the file or folder i.e. 'image'
131
+     *
132
+     * @return string
133
+     * @since 7.0.0
134
+     */
135
+    public function getMimePart();
136 136
 
137
-	/**
138
-	 * Get the storage the file or folder is storage on
139
-	 *
140
-	 * @return \OCP\Files\Storage
141
-	 * @since 7.0.0
142
-	 */
143
-	public function getStorage();
137
+    /**
138
+     * Get the storage the file or folder is storage on
139
+     *
140
+     * @return \OCP\Files\Storage
141
+     * @since 7.0.0
142
+     */
143
+    public function getStorage();
144 144
 
145
-	/**
146
-	 * Get the file id of the file or folder
147
-	 *
148
-	 * @return int|null
149
-	 * @since 7.0.0
150
-	 */
151
-	public function getId();
145
+    /**
146
+     * Get the file id of the file or folder
147
+     *
148
+     * @return int|null
149
+     * @since 7.0.0
150
+     */
151
+    public function getId();
152 152
 
153
-	/**
154
-	 * Check whether the file is encrypted
155
-	 *
156
-	 * @return bool
157
-	 * @since 7.0.0
158
-	 */
159
-	public function isEncrypted();
153
+    /**
154
+     * Check whether the file is encrypted
155
+     *
156
+     * @return bool
157
+     * @since 7.0.0
158
+     */
159
+    public function isEncrypted();
160 160
 
161
-	/**
162
-	 * Get the permissions of the file or folder as bitmasked combination of the following constants
163
-	 * \OCP\Constants::PERMISSION_CREATE
164
-	 * \OCP\Constants::PERMISSION_READ
165
-	 * \OCP\Constants::PERMISSION_UPDATE
166
-	 * \OCP\Constants::PERMISSION_DELETE
167
-	 * \OCP\Constants::PERMISSION_SHARE
168
-	 * \OCP\Constants::PERMISSION_ALL
169
-	 *
170
-	 * @return int
171
-	 * @since 7.0.0 - namespace of constants has changed in 8.0.0
172
-	 */
173
-	public function getPermissions();
161
+    /**
162
+     * Get the permissions of the file or folder as bitmasked combination of the following constants
163
+     * \OCP\Constants::PERMISSION_CREATE
164
+     * \OCP\Constants::PERMISSION_READ
165
+     * \OCP\Constants::PERMISSION_UPDATE
166
+     * \OCP\Constants::PERMISSION_DELETE
167
+     * \OCP\Constants::PERMISSION_SHARE
168
+     * \OCP\Constants::PERMISSION_ALL
169
+     *
170
+     * @return int
171
+     * @since 7.0.0 - namespace of constants has changed in 8.0.0
172
+     */
173
+    public function getPermissions();
174 174
 
175
-	/**
176
-	 * Check whether this is a file or a folder
177
-	 *
178
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
179
-	 * @since 7.0.0
180
-	 */
181
-	public function getType();
175
+    /**
176
+     * Check whether this is a file or a folder
177
+     *
178
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
179
+     * @since 7.0.0
180
+     */
181
+    public function getType();
182 182
 
183
-	/**
184
-	 * Check if the file or folder is readable
185
-	 *
186
-	 * @return bool
187
-	 * @since 7.0.0
188
-	 */
189
-	public function isReadable();
183
+    /**
184
+     * Check if the file or folder is readable
185
+     *
186
+     * @return bool
187
+     * @since 7.0.0
188
+     */
189
+    public function isReadable();
190 190
 
191
-	/**
192
-	 * Check if a file is writable
193
-	 *
194
-	 * @return bool
195
-	 * @since 7.0.0
196
-	 */
197
-	public function isUpdateable();
191
+    /**
192
+     * Check if a file is writable
193
+     *
194
+     * @return bool
195
+     * @since 7.0.0
196
+     */
197
+    public function isUpdateable();
198 198
 
199
-	/**
200
-	 * Check whether new files or folders can be created inside this folder
201
-	 *
202
-	 * @return bool
203
-	 * @since 8.0.0
204
-	 */
205
-	public function isCreatable();
199
+    /**
200
+     * Check whether new files or folders can be created inside this folder
201
+     *
202
+     * @return bool
203
+     * @since 8.0.0
204
+     */
205
+    public function isCreatable();
206 206
 
207
-	/**
208
-	 * Check if a file or folder can be deleted
209
-	 *
210
-	 * @return bool
211
-	 * @since 7.0.0
212
-	 */
213
-	public function isDeletable();
207
+    /**
208
+     * Check if a file or folder can be deleted
209
+     *
210
+     * @return bool
211
+     * @since 7.0.0
212
+     */
213
+    public function isDeletable();
214 214
 
215
-	/**
216
-	 * Check if a file or folder can be shared
217
-	 *
218
-	 * @return bool
219
-	 * @since 7.0.0
220
-	 */
221
-	public function isShareable();
215
+    /**
216
+     * Check if a file or folder can be shared
217
+     *
218
+     * @return bool
219
+     * @since 7.0.0
220
+     */
221
+    public function isShareable();
222 222
 
223
-	/**
224
-	 * Check if a file or folder is shared
225
-	 *
226
-	 * @return bool
227
-	 * @since 7.0.0
228
-	 */
229
-	public function isShared();
223
+    /**
224
+     * Check if a file or folder is shared
225
+     *
226
+     * @return bool
227
+     * @since 7.0.0
228
+     */
229
+    public function isShared();
230 230
 
231
-	/**
232
-	 * Check if a file or folder is mounted
233
-	 *
234
-	 * @return bool
235
-	 * @since 7.0.0
236
-	 */
237
-	public function isMounted();
231
+    /**
232
+     * Check if a file or folder is mounted
233
+     *
234
+     * @return bool
235
+     * @since 7.0.0
236
+     */
237
+    public function isMounted();
238 238
 
239
-	/**
240
-	 * Get the mountpoint the file belongs to
241
-	 *
242
-	 * @return \OCP\Files\Mount\IMountPoint
243
-	 * @since 8.0.0
244
-	 */
245
-	public function getMountPoint();
239
+    /**
240
+     * Get the mountpoint the file belongs to
241
+     *
242
+     * @return \OCP\Files\Mount\IMountPoint
243
+     * @since 8.0.0
244
+     */
245
+    public function getMountPoint();
246 246
 
247
-	/**
248
-	 * Get the owner of the file
249
-	 *
250
-	 * @return \OCP\IUser
251
-	 * @since 9.0.0
252
-	 */
253
-	public function getOwner();
247
+    /**
248
+     * Get the owner of the file
249
+     *
250
+     * @return \OCP\IUser
251
+     * @since 9.0.0
252
+     */
253
+    public function getOwner();
254 254
 
255
-	/**
256
-	 * Get the stored checksum for this file
257
-	 *
258
-	 * @return string
259
-	 * @since 9.0.0
260
-	 */
261
-	public function getChecksum();
255
+    /**
256
+     * Get the stored checksum for this file
257
+     *
258
+     * @return string
259
+     * @since 9.0.0
260
+     */
261
+    public function getChecksum();
262 262
 
263
-	/**
264
-	 * Get the extension of the file
265
-	 *
266
-	 * @return string
267
-	 * @since 15.0.0
268
-	 */
269
-	public function getExtension(): string;
263
+    /**
264
+     * Get the extension of the file
265
+     *
266
+     * @return string
267
+     * @since 15.0.0
268
+     */
269
+    public function getExtension(): string;
270 270
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/File.php 1 patch
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -30,120 +30,120 @@
 block discarded – undo
30 30
 use OCP\Files\NotPermittedException;
31 31
 
32 32
 class File extends Node implements \OCP\Files\File {
33
-	/**
34
-	 * Creates a Folder that represents a non-existing path
35
-	 *
36
-	 * @param string $path path
37
-	 * @return string non-existing node class
38
-	 */
39
-	protected function createNonExistingNode($path) {
40
-		return new NonExistingFile($this->root, $this->view, $path);
41
-	}
33
+    /**
34
+     * Creates a Folder that represents a non-existing path
35
+     *
36
+     * @param string $path path
37
+     * @return string non-existing node class
38
+     */
39
+    protected function createNonExistingNode($path) {
40
+        return new NonExistingFile($this->root, $this->view, $path);
41
+    }
42 42
 
43
-	/**
44
-	 * @return string
45
-	 * @throws \OCP\Files\NotPermittedException
46
-	 */
47
-	public function getContent() {
48
-		if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
49
-			/**
50
-			 * @var \OC\Files\Storage\Storage $storage;
51
-			 */
52
-			return $this->view->file_get_contents($this->path);
53
-		} else {
54
-			throw new NotPermittedException();
55
-		}
56
-	}
43
+    /**
44
+     * @return string
45
+     * @throws \OCP\Files\NotPermittedException
46
+     */
47
+    public function getContent() {
48
+        if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
49
+            /**
50
+             * @var \OC\Files\Storage\Storage $storage;
51
+             */
52
+            return $this->view->file_get_contents($this->path);
53
+        } else {
54
+            throw new NotPermittedException();
55
+        }
56
+    }
57 57
 
58
-	/**
59
-	 * @param string|resource $data
60
-	 * @throws \OCP\Files\NotPermittedException
61
-	 * @throws \OCP\Files\GenericFileException
62
-	 */
63
-	public function putContent($data) {
64
-		if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
65
-			$this->sendHooks(array('preWrite'));
66
-			if ($this->view->file_put_contents($this->path, $data) === false) {
67
-				throw new GenericFileException('file_put_contents failed');
68
-			}
69
-			$this->fileInfo = null;
70
-			$this->sendHooks(array('postWrite'));
71
-		} else {
72
-			throw new NotPermittedException();
73
-		}
74
-	}
58
+    /**
59
+     * @param string|resource $data
60
+     * @throws \OCP\Files\NotPermittedException
61
+     * @throws \OCP\Files\GenericFileException
62
+     */
63
+    public function putContent($data) {
64
+        if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
65
+            $this->sendHooks(array('preWrite'));
66
+            if ($this->view->file_put_contents($this->path, $data) === false) {
67
+                throw new GenericFileException('file_put_contents failed');
68
+            }
69
+            $this->fileInfo = null;
70
+            $this->sendHooks(array('postWrite'));
71
+        } else {
72
+            throw new NotPermittedException();
73
+        }
74
+    }
75 75
 
76
-	/**
77
-	 * @param string $mode
78
-	 * @return resource
79
-	 * @throws \OCP\Files\NotPermittedException
80
-	 */
81
-	public function fopen($mode) {
82
-		$preHooks = array();
83
-		$postHooks = array();
84
-		$requiredPermissions = \OCP\Constants::PERMISSION_READ;
85
-		switch ($mode) {
86
-			case 'r+':
87
-			case 'rb+':
88
-			case 'w+':
89
-			case 'wb+':
90
-			case 'x+':
91
-			case 'xb+':
92
-			case 'a+':
93
-			case 'ab+':
94
-			case 'w':
95
-			case 'wb':
96
-			case 'x':
97
-			case 'xb':
98
-			case 'a':
99
-			case 'ab':
100
-				$preHooks[] = 'preWrite';
101
-				$postHooks[] = 'postWrite';
102
-				$requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE;
103
-				break;
104
-		}
76
+    /**
77
+     * @param string $mode
78
+     * @return resource
79
+     * @throws \OCP\Files\NotPermittedException
80
+     */
81
+    public function fopen($mode) {
82
+        $preHooks = array();
83
+        $postHooks = array();
84
+        $requiredPermissions = \OCP\Constants::PERMISSION_READ;
85
+        switch ($mode) {
86
+            case 'r+':
87
+            case 'rb+':
88
+            case 'w+':
89
+            case 'wb+':
90
+            case 'x+':
91
+            case 'xb+':
92
+            case 'a+':
93
+            case 'ab+':
94
+            case 'w':
95
+            case 'wb':
96
+            case 'x':
97
+            case 'xb':
98
+            case 'a':
99
+            case 'ab':
100
+                $preHooks[] = 'preWrite';
101
+                $postHooks[] = 'postWrite';
102
+                $requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE;
103
+                break;
104
+        }
105 105
 
106
-		if ($this->checkPermissions($requiredPermissions)) {
107
-			$this->sendHooks($preHooks);
108
-			$result = $this->view->fopen($this->path, $mode);
109
-			$this->sendHooks($postHooks);
110
-			return $result;
111
-		} else {
112
-			throw new NotPermittedException();
113
-		}
114
-	}
106
+        if ($this->checkPermissions($requiredPermissions)) {
107
+            $this->sendHooks($preHooks);
108
+            $result = $this->view->fopen($this->path, $mode);
109
+            $this->sendHooks($postHooks);
110
+            return $result;
111
+        } else {
112
+            throw new NotPermittedException();
113
+        }
114
+    }
115 115
 
116
-	public function delete() {
117
-		if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
118
-			$this->sendHooks(array('preDelete'));
119
-			$fileInfo = $this->getFileInfo();
120
-			$this->view->unlink($this->path);
121
-			$nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo);
122
-			$this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
123
-			$this->exists = false;
124
-			$this->fileInfo = null;
125
-		} else {
126
-			throw new NotPermittedException();
127
-		}
128
-	}
116
+    public function delete() {
117
+        if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
118
+            $this->sendHooks(array('preDelete'));
119
+            $fileInfo = $this->getFileInfo();
120
+            $this->view->unlink($this->path);
121
+            $nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo);
122
+            $this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
123
+            $this->exists = false;
124
+            $this->fileInfo = null;
125
+        } else {
126
+            throw new NotPermittedException();
127
+        }
128
+    }
129 129
 
130
-	/**
131
-	 * @param string $type
132
-	 * @param bool $raw
133
-	 * @return string
134
-	 */
135
-	public function hash($type, $raw = false) {
136
-		return $this->view->hash($type, $this->path, $raw);
137
-	}
130
+    /**
131
+     * @param string $type
132
+     * @param bool $raw
133
+     * @return string
134
+     */
135
+    public function hash($type, $raw = false) {
136
+        return $this->view->hash($type, $this->path, $raw);
137
+    }
138 138
 
139
-	/**
140
-	 * @inheritdoc
141
-	 */
142
-	public function getChecksum() {
143
-		return $this->getFileInfo()->getChecksum();
144
-	}
139
+    /**
140
+     * @inheritdoc
141
+     */
142
+    public function getChecksum() {
143
+        return $this->getFileInfo()->getChecksum();
144
+    }
145 145
 
146
-	public function getExtension(): string {
147
-		return $this->getFileInfo()->getExtension();
148
-	}
146
+    public function getExtension(): string {
147
+        return $this->getFileInfo()->getExtension();
148
+    }
149 149
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/LazyRoot.php 1 patch
Indentation   +447 added lines, -447 removed lines patch added patch discarded remove patch
@@ -33,451 +33,451 @@
 block discarded – undo
33 33
  * @package OC\Files\Node
34 34
  */
35 35
 class LazyRoot implements IRootFolder {
36
-	/** @var \Closure */
37
-	private $rootFolderClosure;
38
-
39
-	/** @var IRootFolder */
40
-	private $rootFolder;
41
-
42
-	/**
43
-	 * LazyRoot constructor.
44
-	 *
45
-	 * @param \Closure $rootFolderClosure
46
-	 */
47
-	public function __construct(\Closure $rootFolderClosure) {
48
-		$this->rootFolderClosure = $rootFolderClosure;
49
-	}
50
-
51
-	/**
52
-	 * Magic method to first get the real rootFolder and then
53
-	 * call $method with $args on it
54
-	 *
55
-	 * @param $method
56
-	 * @param $args
57
-	 * @return mixed
58
-	 */
59
-	public function __call($method, $args) {
60
-		if ($this->rootFolder === null) {
61
-			$this->rootFolder = call_user_func($this->rootFolderClosure);
62
-		}
63
-
64
-		return call_user_func_array([$this->rootFolder, $method], $args);
65
-	}
66
-
67
-	/**
68
-	 * @inheritDoc
69
-	 */
70
-	public function getUser() {
71
-		return $this->__call(__FUNCTION__, func_get_args());
72
-	}
73
-
74
-	/**
75
-	 * @inheritDoc
76
-	 */
77
-	public function listen($scope, $method, callable $callback) {
78
-		$this->__call(__FUNCTION__, func_get_args());
79
-	}
80
-
81
-	/**
82
-	 * @inheritDoc
83
-	 */
84
-	public function removeListener($scope = null, $method = null, callable $callback = null) {
85
-		$this->__call(__FUNCTION__, func_get_args());
86
-	}
87
-
88
-	/**
89
-	 * @inheritDoc
90
-	 */
91
-	public function emit($scope, $method, $arguments = array()) {
92
-		$this->__call(__FUNCTION__, func_get_args());
93
-	}
94
-
95
-	/**
96
-	 * @inheritDoc
97
-	 */
98
-	public function mount($storage, $mountPoint, $arguments = array()) {
99
-		$this->__call(__FUNCTION__, func_get_args());
100
-	}
101
-
102
-	/**
103
-	 * @inheritDoc
104
-	 */
105
-	public function getMount($mountPoint) {
106
-		return $this->__call(__FUNCTION__, func_get_args());
107
-	}
108
-
109
-	/**
110
-	 * @inheritDoc
111
-	 */
112
-	public function getMountsIn($mountPoint) {
113
-		return $this->__call(__FUNCTION__, func_get_args());
114
-	}
115
-
116
-	/**
117
-	 * @inheritDoc
118
-	 */
119
-	public function getMountByStorageId($storageId) {
120
-		return $this->__call(__FUNCTION__, func_get_args());
121
-	}
122
-
123
-	/**
124
-	 * @inheritDoc
125
-	 */
126
-	public function getMountByNumericStorageId($numericId) {
127
-		return $this->__call(__FUNCTION__, func_get_args());
128
-	}
129
-
130
-	/**
131
-	 * @inheritDoc
132
-	 */
133
-	public function unMount($mount) {
134
-		$this->__call(__FUNCTION__, func_get_args());
135
-	}
136
-
137
-	/**
138
-	 * @inheritDoc
139
-	 */
140
-	public function get($path) {
141
-		return $this->__call(__FUNCTION__, func_get_args());
142
-	}
143
-
144
-	/**
145
-	 * @inheritDoc
146
-	 */
147
-	public function rename($targetPath) {
148
-		return $this->__call(__FUNCTION__, func_get_args());
149
-	}
150
-
151
-	/**
152
-	 * @inheritDoc
153
-	 */
154
-	public function delete() {
155
-		return $this->__call(__FUNCTION__, func_get_args());
156
-	}
157
-
158
-	/**
159
-	 * @inheritDoc
160
-	 */
161
-	public function copy($targetPath) {
162
-		return $this->__call(__FUNCTION__, func_get_args());
163
-	}
164
-
165
-	/**
166
-	 * @inheritDoc
167
-	 */
168
-	public function touch($mtime = null) {
169
-		$this->__call(__FUNCTION__, func_get_args());
170
-	}
171
-
172
-	/**
173
-	 * @inheritDoc
174
-	 */
175
-	public function getStorage() {
176
-		return $this->__call(__FUNCTION__, func_get_args());
177
-	}
178
-
179
-	/**
180
-	 * @inheritDoc
181
-	 */
182
-	public function getPath() {
183
-		return $this->__call(__FUNCTION__, func_get_args());
184
-	}
185
-
186
-	/**
187
-	 * @inheritDoc
188
-	 */
189
-	public function getInternalPath() {
190
-		return $this->__call(__FUNCTION__, func_get_args());
191
-	}
192
-
193
-	/**
194
-	 * @inheritDoc
195
-	 */
196
-	public function getId() {
197
-		return $this->__call(__FUNCTION__, func_get_args());
198
-	}
199
-
200
-	/**
201
-	 * @inheritDoc
202
-	 */
203
-	public function stat() {
204
-		return $this->__call(__FUNCTION__, func_get_args());
205
-	}
206
-
207
-	/**
208
-	 * @inheritDoc
209
-	 */
210
-	public function getMTime() {
211
-		return $this->__call(__FUNCTION__, func_get_args());
212
-	}
213
-
214
-	/**
215
-	 * @inheritDoc
216
-	 */
217
-	public function getSize() {
218
-		return $this->__call(__FUNCTION__, func_get_args());
219
-	}
220
-
221
-	/**
222
-	 * @inheritDoc
223
-	 */
224
-	public function getEtag() {
225
-		return $this->__call(__FUNCTION__, func_get_args());
226
-	}
227
-
228
-	/**
229
-	 * @inheritDoc
230
-	 */
231
-	public function getPermissions() {
232
-		return $this->__call(__FUNCTION__, func_get_args());
233
-	}
234
-
235
-	/**
236
-	 * @inheritDoc
237
-	 */
238
-	public function isReadable() {
239
-		return $this->__call(__FUNCTION__, func_get_args());
240
-	}
241
-
242
-	/**
243
-	 * @inheritDoc
244
-	 */
245
-	public function isUpdateable() {
246
-		return $this->__call(__FUNCTION__, func_get_args());
247
-	}
248
-
249
-	/**
250
-	 * @inheritDoc
251
-	 */
252
-	public function isDeletable() {
253
-		return $this->__call(__FUNCTION__, func_get_args());
254
-	}
255
-
256
-	/**
257
-	 * @inheritDoc
258
-	 */
259
-	public function isShareable() {
260
-		return $this->__call(__FUNCTION__, func_get_args());
261
-	}
262
-
263
-	/**
264
-	 * @inheritDoc
265
-	 */
266
-	public function getParent() {
267
-		return $this->__call(__FUNCTION__, func_get_args());
268
-	}
269
-
270
-	/**
271
-	 * @inheritDoc
272
-	 */
273
-	public function getName() {
274
-		return $this->__call(__FUNCTION__, func_get_args());
275
-	}
276
-
277
-	/**
278
-	 * @inheritDoc
279
-	 */
280
-	public function getUserFolder($userId) {
281
-		return $this->__call(__FUNCTION__, func_get_args());
282
-	}
283
-
284
-	/**
285
-	 * @inheritDoc
286
-	 */
287
-	public function getMimetype() {
288
-		return $this->__call(__FUNCTION__, func_get_args());
289
-	}
290
-
291
-	/**
292
-	 * @inheritDoc
293
-	 */
294
-	public function getMimePart() {
295
-		return $this->__call(__FUNCTION__, func_get_args());
296
-	}
297
-
298
-	/**
299
-	 * @inheritDoc
300
-	 */
301
-	public function isEncrypted() {
302
-		return $this->__call(__FUNCTION__, func_get_args());
303
-	}
304
-
305
-	/**
306
-	 * @inheritDoc
307
-	 */
308
-	public function getType() {
309
-		return $this->__call(__FUNCTION__, func_get_args());
310
-	}
311
-
312
-	/**
313
-	 * @inheritDoc
314
-	 */
315
-	public function isShared() {
316
-		return $this->__call(__FUNCTION__, func_get_args());
317
-	}
318
-
319
-	/**
320
-	 * @inheritDoc
321
-	 */
322
-	public function isMounted() {
323
-		return $this->__call(__FUNCTION__, func_get_args());
324
-	}
325
-
326
-	/**
327
-	 * @inheritDoc
328
-	 */
329
-	public function getMountPoint() {
330
-		return $this->__call(__FUNCTION__, func_get_args());
331
-	}
332
-
333
-	/**
334
-	 * @inheritDoc
335
-	 */
336
-	public function getOwner() {
337
-		return $this->__call(__FUNCTION__, func_get_args());
338
-	}
339
-
340
-	/**
341
-	 * @inheritDoc
342
-	 */
343
-	public function getChecksum() {
344
-		return $this->__call(__FUNCTION__, func_get_args());
345
-	}
346
-
347
-	public function getExtension(): string {
348
-		return $this->__call(__FUNCTION__, func_get_args());
349
-	}
350
-
351
-	/**
352
-	 * @inheritDoc
353
-	 */
354
-	public function getFullPath($path) {
355
-		return $this->__call(__FUNCTION__, func_get_args());
356
-	}
357
-
358
-	/**
359
-	 * @inheritDoc
360
-	 */
361
-	public function getRelativePath($path) {
362
-		return $this->__call(__FUNCTION__, func_get_args());
363
-	}
364
-
365
-	/**
366
-	 * @inheritDoc
367
-	 */
368
-	public function isSubNode($node) {
369
-		return $this->__call(__FUNCTION__, func_get_args());
370
-	}
371
-
372
-	/**
373
-	 * @inheritDoc
374
-	 */
375
-	public function getDirectoryListing() {
376
-		return $this->__call(__FUNCTION__, func_get_args());
377
-	}
378
-
379
-	/**
380
-	 * @inheritDoc
381
-	 */
382
-	public function nodeExists($path) {
383
-		return $this->__call(__FUNCTION__, func_get_args());
384
-	}
385
-
386
-	/**
387
-	 * @inheritDoc
388
-	 */
389
-	public function newFolder($path) {
390
-		return $this->__call(__FUNCTION__, func_get_args());
391
-	}
392
-
393
-	/**
394
-	 * @inheritDoc
395
-	 */
396
-	public function newFile($path) {
397
-		return $this->__call(__FUNCTION__, func_get_args());
398
-	}
399
-
400
-	/**
401
-	 * @inheritDoc
402
-	 */
403
-	public function search($query) {
404
-		return $this->__call(__FUNCTION__, func_get_args());
405
-	}
406
-
407
-	/**
408
-	 * @inheritDoc
409
-	 */
410
-	public function searchByMime($mimetype) {
411
-		return $this->__call(__FUNCTION__, func_get_args());
412
-	}
413
-
414
-	/**
415
-	 * @inheritDoc
416
-	 */
417
-	public function searchByTag($tag, $userId) {
418
-		return $this->__call(__FUNCTION__, func_get_args());
419
-	}
420
-
421
-	/**
422
-	 * @inheritDoc
423
-	 */
424
-	public function getById($id) {
425
-		return $this->__call(__FUNCTION__, func_get_args());
426
-	}
427
-
428
-	/**
429
-	 * @inheritDoc
430
-	 */
431
-	public function getFreeSpace() {
432
-		return $this->__call(__FUNCTION__, func_get_args());
433
-	}
434
-
435
-	/**
436
-	 * @inheritDoc
437
-	 */
438
-	public function isCreatable() {
439
-		return $this->__call(__FUNCTION__, func_get_args());
440
-	}
441
-
442
-	/**
443
-	 * @inheritDoc
444
-	 */
445
-	public function getNonExistingName($name) {
446
-		return $this->__call(__FUNCTION__, func_get_args());
447
-	}
448
-
449
-	/**
450
-	 * @inheritDoc
451
-	 */
452
-	public function move($targetPath) {
453
-		return $this->__call(__FUNCTION__, func_get_args());
454
-	}
455
-
456
-	/**
457
-	 * @inheritDoc
458
-	 */
459
-	public function lock($type) {
460
-		return $this->__call(__FUNCTION__, func_get_args());
461
-	}
462
-
463
-	/**
464
-	 * @inheritDoc
465
-	 */
466
-	public function changeLock($targetType) {
467
-		return $this->__call(__FUNCTION__, func_get_args());
468
-	}
469
-
470
-	/**
471
-	 * @inheritDoc
472
-	 */
473
-	public function unlock($type) {
474
-		return $this->__call(__FUNCTION__, func_get_args());
475
-	}
476
-
477
-	/**
478
-	 * @inheritDoc
479
-	 */
480
-	public function getRecent($limit, $offset = 0) {
481
-		return $this->__call(__FUNCTION__, func_get_args());
482
-	}
36
+    /** @var \Closure */
37
+    private $rootFolderClosure;
38
+
39
+    /** @var IRootFolder */
40
+    private $rootFolder;
41
+
42
+    /**
43
+     * LazyRoot constructor.
44
+     *
45
+     * @param \Closure $rootFolderClosure
46
+     */
47
+    public function __construct(\Closure $rootFolderClosure) {
48
+        $this->rootFolderClosure = $rootFolderClosure;
49
+    }
50
+
51
+    /**
52
+     * Magic method to first get the real rootFolder and then
53
+     * call $method with $args on it
54
+     *
55
+     * @param $method
56
+     * @param $args
57
+     * @return mixed
58
+     */
59
+    public function __call($method, $args) {
60
+        if ($this->rootFolder === null) {
61
+            $this->rootFolder = call_user_func($this->rootFolderClosure);
62
+        }
63
+
64
+        return call_user_func_array([$this->rootFolder, $method], $args);
65
+    }
66
+
67
+    /**
68
+     * @inheritDoc
69
+     */
70
+    public function getUser() {
71
+        return $this->__call(__FUNCTION__, func_get_args());
72
+    }
73
+
74
+    /**
75
+     * @inheritDoc
76
+     */
77
+    public function listen($scope, $method, callable $callback) {
78
+        $this->__call(__FUNCTION__, func_get_args());
79
+    }
80
+
81
+    /**
82
+     * @inheritDoc
83
+     */
84
+    public function removeListener($scope = null, $method = null, callable $callback = null) {
85
+        $this->__call(__FUNCTION__, func_get_args());
86
+    }
87
+
88
+    /**
89
+     * @inheritDoc
90
+     */
91
+    public function emit($scope, $method, $arguments = array()) {
92
+        $this->__call(__FUNCTION__, func_get_args());
93
+    }
94
+
95
+    /**
96
+     * @inheritDoc
97
+     */
98
+    public function mount($storage, $mountPoint, $arguments = array()) {
99
+        $this->__call(__FUNCTION__, func_get_args());
100
+    }
101
+
102
+    /**
103
+     * @inheritDoc
104
+     */
105
+    public function getMount($mountPoint) {
106
+        return $this->__call(__FUNCTION__, func_get_args());
107
+    }
108
+
109
+    /**
110
+     * @inheritDoc
111
+     */
112
+    public function getMountsIn($mountPoint) {
113
+        return $this->__call(__FUNCTION__, func_get_args());
114
+    }
115
+
116
+    /**
117
+     * @inheritDoc
118
+     */
119
+    public function getMountByStorageId($storageId) {
120
+        return $this->__call(__FUNCTION__, func_get_args());
121
+    }
122
+
123
+    /**
124
+     * @inheritDoc
125
+     */
126
+    public function getMountByNumericStorageId($numericId) {
127
+        return $this->__call(__FUNCTION__, func_get_args());
128
+    }
129
+
130
+    /**
131
+     * @inheritDoc
132
+     */
133
+    public function unMount($mount) {
134
+        $this->__call(__FUNCTION__, func_get_args());
135
+    }
136
+
137
+    /**
138
+     * @inheritDoc
139
+     */
140
+    public function get($path) {
141
+        return $this->__call(__FUNCTION__, func_get_args());
142
+    }
143
+
144
+    /**
145
+     * @inheritDoc
146
+     */
147
+    public function rename($targetPath) {
148
+        return $this->__call(__FUNCTION__, func_get_args());
149
+    }
150
+
151
+    /**
152
+     * @inheritDoc
153
+     */
154
+    public function delete() {
155
+        return $this->__call(__FUNCTION__, func_get_args());
156
+    }
157
+
158
+    /**
159
+     * @inheritDoc
160
+     */
161
+    public function copy($targetPath) {
162
+        return $this->__call(__FUNCTION__, func_get_args());
163
+    }
164
+
165
+    /**
166
+     * @inheritDoc
167
+     */
168
+    public function touch($mtime = null) {
169
+        $this->__call(__FUNCTION__, func_get_args());
170
+    }
171
+
172
+    /**
173
+     * @inheritDoc
174
+     */
175
+    public function getStorage() {
176
+        return $this->__call(__FUNCTION__, func_get_args());
177
+    }
178
+
179
+    /**
180
+     * @inheritDoc
181
+     */
182
+    public function getPath() {
183
+        return $this->__call(__FUNCTION__, func_get_args());
184
+    }
185
+
186
+    /**
187
+     * @inheritDoc
188
+     */
189
+    public function getInternalPath() {
190
+        return $this->__call(__FUNCTION__, func_get_args());
191
+    }
192
+
193
+    /**
194
+     * @inheritDoc
195
+     */
196
+    public function getId() {
197
+        return $this->__call(__FUNCTION__, func_get_args());
198
+    }
199
+
200
+    /**
201
+     * @inheritDoc
202
+     */
203
+    public function stat() {
204
+        return $this->__call(__FUNCTION__, func_get_args());
205
+    }
206
+
207
+    /**
208
+     * @inheritDoc
209
+     */
210
+    public function getMTime() {
211
+        return $this->__call(__FUNCTION__, func_get_args());
212
+    }
213
+
214
+    /**
215
+     * @inheritDoc
216
+     */
217
+    public function getSize() {
218
+        return $this->__call(__FUNCTION__, func_get_args());
219
+    }
220
+
221
+    /**
222
+     * @inheritDoc
223
+     */
224
+    public function getEtag() {
225
+        return $this->__call(__FUNCTION__, func_get_args());
226
+    }
227
+
228
+    /**
229
+     * @inheritDoc
230
+     */
231
+    public function getPermissions() {
232
+        return $this->__call(__FUNCTION__, func_get_args());
233
+    }
234
+
235
+    /**
236
+     * @inheritDoc
237
+     */
238
+    public function isReadable() {
239
+        return $this->__call(__FUNCTION__, func_get_args());
240
+    }
241
+
242
+    /**
243
+     * @inheritDoc
244
+     */
245
+    public function isUpdateable() {
246
+        return $this->__call(__FUNCTION__, func_get_args());
247
+    }
248
+
249
+    /**
250
+     * @inheritDoc
251
+     */
252
+    public function isDeletable() {
253
+        return $this->__call(__FUNCTION__, func_get_args());
254
+    }
255
+
256
+    /**
257
+     * @inheritDoc
258
+     */
259
+    public function isShareable() {
260
+        return $this->__call(__FUNCTION__, func_get_args());
261
+    }
262
+
263
+    /**
264
+     * @inheritDoc
265
+     */
266
+    public function getParent() {
267
+        return $this->__call(__FUNCTION__, func_get_args());
268
+    }
269
+
270
+    /**
271
+     * @inheritDoc
272
+     */
273
+    public function getName() {
274
+        return $this->__call(__FUNCTION__, func_get_args());
275
+    }
276
+
277
+    /**
278
+     * @inheritDoc
279
+     */
280
+    public function getUserFolder($userId) {
281
+        return $this->__call(__FUNCTION__, func_get_args());
282
+    }
283
+
284
+    /**
285
+     * @inheritDoc
286
+     */
287
+    public function getMimetype() {
288
+        return $this->__call(__FUNCTION__, func_get_args());
289
+    }
290
+
291
+    /**
292
+     * @inheritDoc
293
+     */
294
+    public function getMimePart() {
295
+        return $this->__call(__FUNCTION__, func_get_args());
296
+    }
297
+
298
+    /**
299
+     * @inheritDoc
300
+     */
301
+    public function isEncrypted() {
302
+        return $this->__call(__FUNCTION__, func_get_args());
303
+    }
304
+
305
+    /**
306
+     * @inheritDoc
307
+     */
308
+    public function getType() {
309
+        return $this->__call(__FUNCTION__, func_get_args());
310
+    }
311
+
312
+    /**
313
+     * @inheritDoc
314
+     */
315
+    public function isShared() {
316
+        return $this->__call(__FUNCTION__, func_get_args());
317
+    }
318
+
319
+    /**
320
+     * @inheritDoc
321
+     */
322
+    public function isMounted() {
323
+        return $this->__call(__FUNCTION__, func_get_args());
324
+    }
325
+
326
+    /**
327
+     * @inheritDoc
328
+     */
329
+    public function getMountPoint() {
330
+        return $this->__call(__FUNCTION__, func_get_args());
331
+    }
332
+
333
+    /**
334
+     * @inheritDoc
335
+     */
336
+    public function getOwner() {
337
+        return $this->__call(__FUNCTION__, func_get_args());
338
+    }
339
+
340
+    /**
341
+     * @inheritDoc
342
+     */
343
+    public function getChecksum() {
344
+        return $this->__call(__FUNCTION__, func_get_args());
345
+    }
346
+
347
+    public function getExtension(): string {
348
+        return $this->__call(__FUNCTION__, func_get_args());
349
+    }
350
+
351
+    /**
352
+     * @inheritDoc
353
+     */
354
+    public function getFullPath($path) {
355
+        return $this->__call(__FUNCTION__, func_get_args());
356
+    }
357
+
358
+    /**
359
+     * @inheritDoc
360
+     */
361
+    public function getRelativePath($path) {
362
+        return $this->__call(__FUNCTION__, func_get_args());
363
+    }
364
+
365
+    /**
366
+     * @inheritDoc
367
+     */
368
+    public function isSubNode($node) {
369
+        return $this->__call(__FUNCTION__, func_get_args());
370
+    }
371
+
372
+    /**
373
+     * @inheritDoc
374
+     */
375
+    public function getDirectoryListing() {
376
+        return $this->__call(__FUNCTION__, func_get_args());
377
+    }
378
+
379
+    /**
380
+     * @inheritDoc
381
+     */
382
+    public function nodeExists($path) {
383
+        return $this->__call(__FUNCTION__, func_get_args());
384
+    }
385
+
386
+    /**
387
+     * @inheritDoc
388
+     */
389
+    public function newFolder($path) {
390
+        return $this->__call(__FUNCTION__, func_get_args());
391
+    }
392
+
393
+    /**
394
+     * @inheritDoc
395
+     */
396
+    public function newFile($path) {
397
+        return $this->__call(__FUNCTION__, func_get_args());
398
+    }
399
+
400
+    /**
401
+     * @inheritDoc
402
+     */
403
+    public function search($query) {
404
+        return $this->__call(__FUNCTION__, func_get_args());
405
+    }
406
+
407
+    /**
408
+     * @inheritDoc
409
+     */
410
+    public function searchByMime($mimetype) {
411
+        return $this->__call(__FUNCTION__, func_get_args());
412
+    }
413
+
414
+    /**
415
+     * @inheritDoc
416
+     */
417
+    public function searchByTag($tag, $userId) {
418
+        return $this->__call(__FUNCTION__, func_get_args());
419
+    }
420
+
421
+    /**
422
+     * @inheritDoc
423
+     */
424
+    public function getById($id) {
425
+        return $this->__call(__FUNCTION__, func_get_args());
426
+    }
427
+
428
+    /**
429
+     * @inheritDoc
430
+     */
431
+    public function getFreeSpace() {
432
+        return $this->__call(__FUNCTION__, func_get_args());
433
+    }
434
+
435
+    /**
436
+     * @inheritDoc
437
+     */
438
+    public function isCreatable() {
439
+        return $this->__call(__FUNCTION__, func_get_args());
440
+    }
441
+
442
+    /**
443
+     * @inheritDoc
444
+     */
445
+    public function getNonExistingName($name) {
446
+        return $this->__call(__FUNCTION__, func_get_args());
447
+    }
448
+
449
+    /**
450
+     * @inheritDoc
451
+     */
452
+    public function move($targetPath) {
453
+        return $this->__call(__FUNCTION__, func_get_args());
454
+    }
455
+
456
+    /**
457
+     * @inheritDoc
458
+     */
459
+    public function lock($type) {
460
+        return $this->__call(__FUNCTION__, func_get_args());
461
+    }
462
+
463
+    /**
464
+     * @inheritDoc
465
+     */
466
+    public function changeLock($targetType) {
467
+        return $this->__call(__FUNCTION__, func_get_args());
468
+    }
469
+
470
+    /**
471
+     * @inheritDoc
472
+     */
473
+    public function unlock($type) {
474
+        return $this->__call(__FUNCTION__, func_get_args());
475
+    }
476
+
477
+    /**
478
+     * @inheritDoc
479
+     */
480
+    public function getRecent($limit, $offset = 0) {
481
+        return $this->__call(__FUNCTION__, func_get_args());
482
+    }
483 483
 }
Please login to merge, or discard this patch.
lib/private/Files/Node/Node.php 1 patch
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -35,400 +35,400 @@
 block discarded – undo
35 35
 
36 36
 // FIXME: this class really should be abstract
37 37
 class Node implements \OCP\Files\Node {
38
-	/**
39
-	 * @var \OC\Files\View $view
40
-	 */
41
-	protected $view;
42
-
43
-	/**
44
-	 * @var \OC\Files\Node\Root $root
45
-	 */
46
-	protected $root;
47
-
48
-	/**
49
-	 * @var string $path
50
-	 */
51
-	protected $path;
52
-
53
-	/**
54
-	 * @var \OCP\Files\FileInfo
55
-	 */
56
-	protected $fileInfo;
57
-
58
-	/**
59
-	 * @param \OC\Files\View $view
60
-	 * @param \OCP\Files\IRootFolder $root
61
-	 * @param string $path
62
-	 * @param FileInfo $fileInfo
63
-	 */
64
-	public function __construct($root, $view, $path, $fileInfo = null) {
65
-		$this->view = $view;
66
-		$this->root = $root;
67
-		$this->path = $path;
68
-		$this->fileInfo = $fileInfo;
69
-	}
70
-
71
-	/**
72
-	 * Creates a Node of the same type that represents a non-existing path
73
-	 *
74
-	 * @param string $path path
75
-	 * @return string non-existing node class
76
-	 */
77
-	protected function createNonExistingNode($path) {
78
-		throw new \Exception('Must be implemented by subclasses');
79
-	}
80
-
81
-	/**
82
-	 * Returns the matching file info
83
-	 *
84
-	 * @return FileInfo
85
-	 * @throws InvalidPathException
86
-	 * @throws NotFoundException
87
-	 */
88
-	public function getFileInfo() {
89
-		if (!Filesystem::isValidPath($this->path)) {
90
-			throw new InvalidPathException();
91
-		}
92
-		if (!$this->fileInfo) {
93
-			$fileInfo = $this->view->getFileInfo($this->path);
94
-			if ($fileInfo instanceof FileInfo) {
95
-				$this->fileInfo = $fileInfo;
96
-			} else {
97
-				throw new NotFoundException();
98
-			}
99
-		}
100
-		return $this->fileInfo;
101
-	}
102
-
103
-	/**
104
-	 * @param string[] $hooks
105
-	 */
106
-	protected function sendHooks($hooks) {
107
-		foreach ($hooks as $hook) {
108
-			$this->root->emit('\OC\Files', $hook, array($this));
109
-		}
110
-	}
111
-
112
-	/**
113
-	 * @param int $permissions
114
-	 * @return bool
115
-	 */
116
-	protected function checkPermissions($permissions) {
117
-		return ($this->getPermissions() & $permissions) === $permissions;
118
-	}
119
-
120
-	public function delete() {
121
-	}
122
-
123
-	/**
124
-	 * @param int $mtime
125
-	 * @throws \OCP\Files\NotPermittedException
126
-	 */
127
-	public function touch($mtime = null) {
128
-		if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
129
-			$this->sendHooks(array('preTouch'));
130
-			$this->view->touch($this->path, $mtime);
131
-			$this->sendHooks(array('postTouch'));
132
-			if ($this->fileInfo) {
133
-				if (is_null($mtime)) {
134
-					$mtime = time();
135
-				}
136
-				$this->fileInfo['mtime'] = $mtime;
137
-			}
138
-		} else {
139
-			throw new NotPermittedException();
140
-		}
141
-	}
142
-
143
-	/**
144
-	 * @return \OC\Files\Storage\Storage
145
-	 * @throws \OCP\Files\NotFoundException
146
-	 */
147
-	public function getStorage() {
148
-		list($storage,) = $this->view->resolvePath($this->path);
149
-		return $storage;
150
-	}
151
-
152
-	/**
153
-	 * @return string
154
-	 */
155
-	public function getPath() {
156
-		return $this->path;
157
-	}
158
-
159
-	/**
160
-	 * @return string
161
-	 */
162
-	public function getInternalPath() {
163
-		list(, $internalPath) = $this->view->resolvePath($this->path);
164
-		return $internalPath;
165
-	}
166
-
167
-	/**
168
-	 * @return int
169
-	 * @throws InvalidPathException
170
-	 * @throws NotFoundException
171
-	 */
172
-	public function getId() {
173
-		return $this->getFileInfo()->getId();
174
-	}
175
-
176
-	/**
177
-	 * @return array
178
-	 */
179
-	public function stat() {
180
-		return $this->view->stat($this->path);
181
-	}
182
-
183
-	/**
184
-	 * @return int
185
-	 * @throws InvalidPathException
186
-	 * @throws NotFoundException
187
-	 */
188
-	public function getMTime() {
189
-		return $this->getFileInfo()->getMTime();
190
-	}
191
-
192
-	/**
193
-	 * @return int
194
-	 * @throws InvalidPathException
195
-	 * @throws NotFoundException
196
-	 */
197
-	public function getSize() {
198
-		return $this->getFileInfo()->getSize();
199
-	}
200
-
201
-	/**
202
-	 * @return string
203
-	 * @throws InvalidPathException
204
-	 * @throws NotFoundException
205
-	 */
206
-	public function getEtag() {
207
-		return $this->getFileInfo()->getEtag();
208
-	}
209
-
210
-	/**
211
-	 * @return int
212
-	 * @throws InvalidPathException
213
-	 * @throws NotFoundException
214
-	 */
215
-	public function getPermissions() {
216
-		return $this->getFileInfo()->getPermissions();
217
-	}
218
-
219
-	/**
220
-	 * @return bool
221
-	 * @throws InvalidPathException
222
-	 * @throws NotFoundException
223
-	 */
224
-	public function isReadable() {
225
-		return $this->getFileInfo()->isReadable();
226
-	}
227
-
228
-	/**
229
-	 * @return bool
230
-	 * @throws InvalidPathException
231
-	 * @throws NotFoundException
232
-	 */
233
-	public function isUpdateable() {
234
-		return $this->getFileInfo()->isUpdateable();
235
-	}
236
-
237
-	/**
238
-	 * @return bool
239
-	 * @throws InvalidPathException
240
-	 * @throws NotFoundException
241
-	 */
242
-	public function isDeletable() {
243
-		return $this->getFileInfo()->isDeletable();
244
-	}
245
-
246
-	/**
247
-	 * @return bool
248
-	 * @throws InvalidPathException
249
-	 * @throws NotFoundException
250
-	 */
251
-	public function isShareable() {
252
-		return $this->getFileInfo()->isShareable();
253
-	}
254
-
255
-	/**
256
-	 * @return bool
257
-	 * @throws InvalidPathException
258
-	 * @throws NotFoundException
259
-	 */
260
-	public function isCreatable() {
261
-		return $this->getFileInfo()->isCreatable();
262
-	}
263
-
264
-	/**
265
-	 * @return Node
266
-	 */
267
-	public function getParent() {
268
-		$newPath = dirname($this->path);
269
-		if ($newPath === '' || $newPath === '.' || $newPath === '/') {
270
-			return $this->root;
271
-		}
272
-		return $this->root->get($newPath);
273
-	}
274
-
275
-	/**
276
-	 * @return string
277
-	 */
278
-	public function getName() {
279
-		return basename($this->path);
280
-	}
281
-
282
-	/**
283
-	 * @param string $path
284
-	 * @return string
285
-	 */
286
-	protected function normalizePath($path) {
287
-		if ($path === '' or $path === '/') {
288
-			return '/';
289
-		}
290
-		//no windows style slashes
291
-		$path = str_replace('\\', '/', $path);
292
-		//add leading slash
293
-		if ($path[0] !== '/') {
294
-			$path = '/' . $path;
295
-		}
296
-		//remove duplicate slashes
297
-		while (strpos($path, '//') !== false) {
298
-			$path = str_replace('//', '/', $path);
299
-		}
300
-		//remove trailing slash
301
-		$path = rtrim($path, '/');
302
-
303
-		return $path;
304
-	}
305
-
306
-	/**
307
-	 * check if the requested path is valid
308
-	 *
309
-	 * @param string $path
310
-	 * @return bool
311
-	 */
312
-	public function isValidPath($path) {
313
-		if (!$path || $path[0] !== '/') {
314
-			$path = '/' . $path;
315
-		}
316
-		if (strstr($path, '/../') || strrchr($path, '/') === '/..') {
317
-			return false;
318
-		}
319
-		return true;
320
-	}
321
-
322
-	public function isMounted() {
323
-		return $this->getFileInfo()->isMounted();
324
-	}
325
-
326
-	public function isShared() {
327
-		return $this->getFileInfo()->isShared();
328
-	}
329
-
330
-	public function getMimeType() {
331
-		return $this->getFileInfo()->getMimetype();
332
-	}
333
-
334
-	public function getMimePart() {
335
-		return $this->getFileInfo()->getMimePart();
336
-	}
337
-
338
-	public function getType() {
339
-		return $this->getFileInfo()->getType();
340
-	}
341
-
342
-	public function isEncrypted() {
343
-		return $this->getFileInfo()->isEncrypted();
344
-	}
345
-
346
-	public function getMountPoint() {
347
-		return $this->getFileInfo()->getMountPoint();
348
-	}
349
-
350
-	public function getOwner() {
351
-		return $this->getFileInfo()->getOwner();
352
-	}
353
-
354
-	public function getChecksum() {
355
-	}
356
-
357
-	public function getExtension(): string {
358
-		return $this->getFileInfo()->getExtension();
359
-	}
360
-
361
-	/**
362
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
363
-	 * @throws \OCP\Lock\LockedException
364
-	 */
365
-	public function lock($type) {
366
-		$this->view->lockFile($this->path, $type);
367
-	}
368
-
369
-	/**
370
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
371
-	 * @throws \OCP\Lock\LockedException
372
-	 */
373
-	public function changeLock($type) {
374
-		$this->view->changeLock($this->path, $type);
375
-	}
376
-
377
-	/**
378
-	 * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
379
-	 * @throws \OCP\Lock\LockedException
380
-	 */
381
-	public function unlock($type) {
382
-		$this->view->unlockFile($this->path, $type);
383
-	}
384
-
385
-	/**
386
-	 * @param string $targetPath
387
-	 * @throws \OCP\Files\NotPermittedException if copy not allowed or failed
388
-	 * @return \OC\Files\Node\Node
389
-	 */
390
-	public function copy($targetPath) {
391
-		$targetPath = $this->normalizePath($targetPath);
392
-		$parent = $this->root->get(dirname($targetPath));
393
-		if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
394
-			$nonExisting = $this->createNonExistingNode($targetPath);
395
-			$this->root->emit('\OC\Files', 'preCopy', [$this, $nonExisting]);
396
-			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
397
-			if (!$this->view->copy($this->path, $targetPath)) {
398
-				throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath);
399
-			}
400
-			$targetNode = $this->root->get($targetPath);
401
-			$this->root->emit('\OC\Files', 'postCopy', [$this, $targetNode]);
402
-			$this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
403
-			return $targetNode;
404
-		} else {
405
-			throw new NotPermittedException('No permission to copy to path ' . $targetPath);
406
-		}
407
-	}
408
-
409
-	/**
410
-	 * @param string $targetPath
411
-	 * @throws \OCP\Files\NotPermittedException if move not allowed or failed
412
-	 * @return \OC\Files\Node\Node
413
-	 */
414
-	public function move($targetPath) {
415
-		$targetPath = $this->normalizePath($targetPath);
416
-		$parent = $this->root->get(dirname($targetPath));
417
-		if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
418
-			$nonExisting = $this->createNonExistingNode($targetPath);
419
-			$this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]);
420
-			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
421
-			if (!$this->view->rename($this->path, $targetPath)) {
422
-				throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath);
423
-			}
424
-			$targetNode = $this->root->get($targetPath);
425
-			$this->root->emit('\OC\Files', 'postRename', [$this, $targetNode]);
426
-			$this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
427
-			$this->path = $targetPath;
428
-			return $targetNode;
429
-		} else {
430
-			throw new NotPermittedException('No permission to move to path ' . $targetPath);
431
-		}
432
-	}
38
+    /**
39
+     * @var \OC\Files\View $view
40
+     */
41
+    protected $view;
42
+
43
+    /**
44
+     * @var \OC\Files\Node\Root $root
45
+     */
46
+    protected $root;
47
+
48
+    /**
49
+     * @var string $path
50
+     */
51
+    protected $path;
52
+
53
+    /**
54
+     * @var \OCP\Files\FileInfo
55
+     */
56
+    protected $fileInfo;
57
+
58
+    /**
59
+     * @param \OC\Files\View $view
60
+     * @param \OCP\Files\IRootFolder $root
61
+     * @param string $path
62
+     * @param FileInfo $fileInfo
63
+     */
64
+    public function __construct($root, $view, $path, $fileInfo = null) {
65
+        $this->view = $view;
66
+        $this->root = $root;
67
+        $this->path = $path;
68
+        $this->fileInfo = $fileInfo;
69
+    }
70
+
71
+    /**
72
+     * Creates a Node of the same type that represents a non-existing path
73
+     *
74
+     * @param string $path path
75
+     * @return string non-existing node class
76
+     */
77
+    protected function createNonExistingNode($path) {
78
+        throw new \Exception('Must be implemented by subclasses');
79
+    }
80
+
81
+    /**
82
+     * Returns the matching file info
83
+     *
84
+     * @return FileInfo
85
+     * @throws InvalidPathException
86
+     * @throws NotFoundException
87
+     */
88
+    public function getFileInfo() {
89
+        if (!Filesystem::isValidPath($this->path)) {
90
+            throw new InvalidPathException();
91
+        }
92
+        if (!$this->fileInfo) {
93
+            $fileInfo = $this->view->getFileInfo($this->path);
94
+            if ($fileInfo instanceof FileInfo) {
95
+                $this->fileInfo = $fileInfo;
96
+            } else {
97
+                throw new NotFoundException();
98
+            }
99
+        }
100
+        return $this->fileInfo;
101
+    }
102
+
103
+    /**
104
+     * @param string[] $hooks
105
+     */
106
+    protected function sendHooks($hooks) {
107
+        foreach ($hooks as $hook) {
108
+            $this->root->emit('\OC\Files', $hook, array($this));
109
+        }
110
+    }
111
+
112
+    /**
113
+     * @param int $permissions
114
+     * @return bool
115
+     */
116
+    protected function checkPermissions($permissions) {
117
+        return ($this->getPermissions() & $permissions) === $permissions;
118
+    }
119
+
120
+    public function delete() {
121
+    }
122
+
123
+    /**
124
+     * @param int $mtime
125
+     * @throws \OCP\Files\NotPermittedException
126
+     */
127
+    public function touch($mtime = null) {
128
+        if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
129
+            $this->sendHooks(array('preTouch'));
130
+            $this->view->touch($this->path, $mtime);
131
+            $this->sendHooks(array('postTouch'));
132
+            if ($this->fileInfo) {
133
+                if (is_null($mtime)) {
134
+                    $mtime = time();
135
+                }
136
+                $this->fileInfo['mtime'] = $mtime;
137
+            }
138
+        } else {
139
+            throw new NotPermittedException();
140
+        }
141
+    }
142
+
143
+    /**
144
+     * @return \OC\Files\Storage\Storage
145
+     * @throws \OCP\Files\NotFoundException
146
+     */
147
+    public function getStorage() {
148
+        list($storage,) = $this->view->resolvePath($this->path);
149
+        return $storage;
150
+    }
151
+
152
+    /**
153
+     * @return string
154
+     */
155
+    public function getPath() {
156
+        return $this->path;
157
+    }
158
+
159
+    /**
160
+     * @return string
161
+     */
162
+    public function getInternalPath() {
163
+        list(, $internalPath) = $this->view->resolvePath($this->path);
164
+        return $internalPath;
165
+    }
166
+
167
+    /**
168
+     * @return int
169
+     * @throws InvalidPathException
170
+     * @throws NotFoundException
171
+     */
172
+    public function getId() {
173
+        return $this->getFileInfo()->getId();
174
+    }
175
+
176
+    /**
177
+     * @return array
178
+     */
179
+    public function stat() {
180
+        return $this->view->stat($this->path);
181
+    }
182
+
183
+    /**
184
+     * @return int
185
+     * @throws InvalidPathException
186
+     * @throws NotFoundException
187
+     */
188
+    public function getMTime() {
189
+        return $this->getFileInfo()->getMTime();
190
+    }
191
+
192
+    /**
193
+     * @return int
194
+     * @throws InvalidPathException
195
+     * @throws NotFoundException
196
+     */
197
+    public function getSize() {
198
+        return $this->getFileInfo()->getSize();
199
+    }
200
+
201
+    /**
202
+     * @return string
203
+     * @throws InvalidPathException
204
+     * @throws NotFoundException
205
+     */
206
+    public function getEtag() {
207
+        return $this->getFileInfo()->getEtag();
208
+    }
209
+
210
+    /**
211
+     * @return int
212
+     * @throws InvalidPathException
213
+     * @throws NotFoundException
214
+     */
215
+    public function getPermissions() {
216
+        return $this->getFileInfo()->getPermissions();
217
+    }
218
+
219
+    /**
220
+     * @return bool
221
+     * @throws InvalidPathException
222
+     * @throws NotFoundException
223
+     */
224
+    public function isReadable() {
225
+        return $this->getFileInfo()->isReadable();
226
+    }
227
+
228
+    /**
229
+     * @return bool
230
+     * @throws InvalidPathException
231
+     * @throws NotFoundException
232
+     */
233
+    public function isUpdateable() {
234
+        return $this->getFileInfo()->isUpdateable();
235
+    }
236
+
237
+    /**
238
+     * @return bool
239
+     * @throws InvalidPathException
240
+     * @throws NotFoundException
241
+     */
242
+    public function isDeletable() {
243
+        return $this->getFileInfo()->isDeletable();
244
+    }
245
+
246
+    /**
247
+     * @return bool
248
+     * @throws InvalidPathException
249
+     * @throws NotFoundException
250
+     */
251
+    public function isShareable() {
252
+        return $this->getFileInfo()->isShareable();
253
+    }
254
+
255
+    /**
256
+     * @return bool
257
+     * @throws InvalidPathException
258
+     * @throws NotFoundException
259
+     */
260
+    public function isCreatable() {
261
+        return $this->getFileInfo()->isCreatable();
262
+    }
263
+
264
+    /**
265
+     * @return Node
266
+     */
267
+    public function getParent() {
268
+        $newPath = dirname($this->path);
269
+        if ($newPath === '' || $newPath === '.' || $newPath === '/') {
270
+            return $this->root;
271
+        }
272
+        return $this->root->get($newPath);
273
+    }
274
+
275
+    /**
276
+     * @return string
277
+     */
278
+    public function getName() {
279
+        return basename($this->path);
280
+    }
281
+
282
+    /**
283
+     * @param string $path
284
+     * @return string
285
+     */
286
+    protected function normalizePath($path) {
287
+        if ($path === '' or $path === '/') {
288
+            return '/';
289
+        }
290
+        //no windows style slashes
291
+        $path = str_replace('\\', '/', $path);
292
+        //add leading slash
293
+        if ($path[0] !== '/') {
294
+            $path = '/' . $path;
295
+        }
296
+        //remove duplicate slashes
297
+        while (strpos($path, '//') !== false) {
298
+            $path = str_replace('//', '/', $path);
299
+        }
300
+        //remove trailing slash
301
+        $path = rtrim($path, '/');
302
+
303
+        return $path;
304
+    }
305
+
306
+    /**
307
+     * check if the requested path is valid
308
+     *
309
+     * @param string $path
310
+     * @return bool
311
+     */
312
+    public function isValidPath($path) {
313
+        if (!$path || $path[0] !== '/') {
314
+            $path = '/' . $path;
315
+        }
316
+        if (strstr($path, '/../') || strrchr($path, '/') === '/..') {
317
+            return false;
318
+        }
319
+        return true;
320
+    }
321
+
322
+    public function isMounted() {
323
+        return $this->getFileInfo()->isMounted();
324
+    }
325
+
326
+    public function isShared() {
327
+        return $this->getFileInfo()->isShared();
328
+    }
329
+
330
+    public function getMimeType() {
331
+        return $this->getFileInfo()->getMimetype();
332
+    }
333
+
334
+    public function getMimePart() {
335
+        return $this->getFileInfo()->getMimePart();
336
+    }
337
+
338
+    public function getType() {
339
+        return $this->getFileInfo()->getType();
340
+    }
341
+
342
+    public function isEncrypted() {
343
+        return $this->getFileInfo()->isEncrypted();
344
+    }
345
+
346
+    public function getMountPoint() {
347
+        return $this->getFileInfo()->getMountPoint();
348
+    }
349
+
350
+    public function getOwner() {
351
+        return $this->getFileInfo()->getOwner();
352
+    }
353
+
354
+    public function getChecksum() {
355
+    }
356
+
357
+    public function getExtension(): string {
358
+        return $this->getFileInfo()->getExtension();
359
+    }
360
+
361
+    /**
362
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
363
+     * @throws \OCP\Lock\LockedException
364
+     */
365
+    public function lock($type) {
366
+        $this->view->lockFile($this->path, $type);
367
+    }
368
+
369
+    /**
370
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
371
+     * @throws \OCP\Lock\LockedException
372
+     */
373
+    public function changeLock($type) {
374
+        $this->view->changeLock($this->path, $type);
375
+    }
376
+
377
+    /**
378
+     * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
379
+     * @throws \OCP\Lock\LockedException
380
+     */
381
+    public function unlock($type) {
382
+        $this->view->unlockFile($this->path, $type);
383
+    }
384
+
385
+    /**
386
+     * @param string $targetPath
387
+     * @throws \OCP\Files\NotPermittedException if copy not allowed or failed
388
+     * @return \OC\Files\Node\Node
389
+     */
390
+    public function copy($targetPath) {
391
+        $targetPath = $this->normalizePath($targetPath);
392
+        $parent = $this->root->get(dirname($targetPath));
393
+        if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
394
+            $nonExisting = $this->createNonExistingNode($targetPath);
395
+            $this->root->emit('\OC\Files', 'preCopy', [$this, $nonExisting]);
396
+            $this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
397
+            if (!$this->view->copy($this->path, $targetPath)) {
398
+                throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath);
399
+            }
400
+            $targetNode = $this->root->get($targetPath);
401
+            $this->root->emit('\OC\Files', 'postCopy', [$this, $targetNode]);
402
+            $this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
403
+            return $targetNode;
404
+        } else {
405
+            throw new NotPermittedException('No permission to copy to path ' . $targetPath);
406
+        }
407
+    }
408
+
409
+    /**
410
+     * @param string $targetPath
411
+     * @throws \OCP\Files\NotPermittedException if move not allowed or failed
412
+     * @return \OC\Files\Node\Node
413
+     */
414
+    public function move($targetPath) {
415
+        $targetPath = $this->normalizePath($targetPath);
416
+        $parent = $this->root->get(dirname($targetPath));
417
+        if ($parent instanceof Folder and $this->isValidPath($targetPath) and $parent->isCreatable()) {
418
+            $nonExisting = $this->createNonExistingNode($targetPath);
419
+            $this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]);
420
+            $this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
421
+            if (!$this->view->rename($this->path, $targetPath)) {
422
+                throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath);
423
+            }
424
+            $targetNode = $this->root->get($targetPath);
425
+            $this->root->emit('\OC\Files', 'postRename', [$this, $targetNode]);
426
+            $this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
427
+            $this->path = $targetPath;
428
+            return $targetNode;
429
+        } else {
430
+            throw new NotPermittedException('No permission to move to path ' . $targetPath);
431
+        }
432
+    }
433 433
 
434 434
 }
Please login to merge, or discard this patch.
lib/private/Files/FileInfo.php 1 patch
Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -38,360 +38,360 @@
 block discarded – undo
38 38
 use OCP\IUser;
39 39
 
40 40
 class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
41
-	/**
42
-	 * @var array $data
43
-	 */
44
-	private $data;
45
-
46
-	/**
47
-	 * @var string $path
48
-	 */
49
-	private $path;
50
-
51
-	/**
52
-	 * @var \OC\Files\Storage\Storage $storage
53
-	 */
54
-	private $storage;
55
-
56
-	/**
57
-	 * @var string $internalPath
58
-	 */
59
-	private $internalPath;
60
-
61
-	/**
62
-	 * @var \OCP\Files\Mount\IMountPoint
63
-	 */
64
-	private $mount;
65
-
66
-	/**
67
-	 * @var IUser
68
-	 */
69
-	private $owner;
70
-
71
-	/**
72
-	 * @var string[]
73
-	 */
74
-	private $childEtags = [];
75
-
76
-	/**
77
-	 * @var IMountPoint[]
78
-	 */
79
-	private $subMounts = [];
80
-
81
-	private $subMountsUsed = false;
82
-
83
-	/**
84
-	 * @param string|boolean $path
85
-	 * @param Storage\Storage $storage
86
-	 * @param string $internalPath
87
-	 * @param array|ICacheEntry $data
88
-	 * @param \OCP\Files\Mount\IMountPoint $mount
89
-	 * @param \OCP\IUser|null $owner
90
-	 */
91
-	public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
92
-		$this->path = $path;
93
-		$this->storage = $storage;
94
-		$this->internalPath = $internalPath;
95
-		$this->data = $data;
96
-		$this->mount = $mount;
97
-		$this->owner = $owner;
98
-	}
99
-
100
-	public function offsetSet($offset, $value) {
101
-		$this->data[$offset] = $value;
102
-	}
103
-
104
-	public function offsetExists($offset) {
105
-		return isset($this->data[$offset]);
106
-	}
107
-
108
-	public function offsetUnset($offset) {
109
-		unset($this->data[$offset]);
110
-	}
111
-
112
-	public function offsetGet($offset) {
113
-		if ($offset === 'type') {
114
-			return $this->getType();
115
-		} else if ($offset === 'etag') {
116
-			return $this->getEtag();
117
-		} else if ($offset === 'size') {
118
-			return $this->getSize();
119
-		} else if ($offset === 'mtime') {
120
-			return $this->getMTime();
121
-		} elseif ($offset === 'permissions') {
122
-			return $this->getPermissions();
123
-		} elseif (isset($this->data[$offset])) {
124
-			return $this->data[$offset];
125
-		} else {
126
-			return null;
127
-		}
128
-	}
129
-
130
-	/**
131
-	 * @return string
132
-	 */
133
-	public function getPath() {
134
-		return $this->path;
135
-	}
136
-
137
-	/**
138
-	 * @return \OCP\Files\Storage
139
-	 */
140
-	public function getStorage() {
141
-		return $this->storage;
142
-	}
143
-
144
-	/**
145
-	 * @return string
146
-	 */
147
-	public function getInternalPath() {
148
-		return $this->internalPath;
149
-	}
150
-
151
-	/**
152
-	 * Get FileInfo ID or null in case of part file
153
-	 *
154
-	 * @return int|null
155
-	 */
156
-	public function getId() {
157
-		return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
158
-	}
159
-
160
-	/**
161
-	 * @return string
162
-	 */
163
-	public function getMimetype() {
164
-		return $this->data['mimetype'];
165
-	}
166
-
167
-	/**
168
-	 * @return string
169
-	 */
170
-	public function getMimePart() {
171
-		return $this->data['mimepart'];
172
-	}
173
-
174
-	/**
175
-	 * @return string
176
-	 */
177
-	public function getName() {
178
-		return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
179
-	}
180
-
181
-	/**
182
-	 * @return string
183
-	 */
184
-	public function getEtag() {
185
-		$this->updateEntryfromSubMounts();
186
-		if (count($this->childEtags) > 0) {
187
-			$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
188
-			return md5($combinedEtag);
189
-		} else {
190
-			return $this->data['etag'];
191
-		}
192
-	}
193
-
194
-	/**
195
-	 * @return int
196
-	 */
197
-	public function getSize() {
198
-		$this->updateEntryfromSubMounts();
199
-		return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
200
-	}
201
-
202
-	/**
203
-	 * @return int
204
-	 */
205
-	public function getMTime() {
206
-		$this->updateEntryfromSubMounts();
207
-		return (int) $this->data['mtime'];
208
-	}
209
-
210
-	/**
211
-	 * @return bool
212
-	 */
213
-	public function isEncrypted() {
214
-		return $this->data['encrypted'];
215
-	}
216
-
217
-	/**
218
-	 * Return the currently version used for the HMAC in the encryption app
219
-	 *
220
-	 * @return int
221
-	 */
222
-	public function getEncryptedVersion() {
223
-		return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
224
-	}
225
-
226
-	/**
227
-	 * @return int
228
-	 */
229
-	public function getPermissions() {
230
-		$perms = (int) $this->data['permissions'];
231
-		if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
232
-			$perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
233
-		}
234
-		return (int) $perms;
235
-	}
236
-
237
-	/**
238
-	 * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
239
-	 */
240
-	public function getType() {
241
-		if (!isset($this->data['type'])) {
242
-			$this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
243
-		}
244
-		return $this->data['type'];
245
-	}
246
-
247
-	public function getData() {
248
-		return $this->data;
249
-	}
250
-
251
-	/**
252
-	 * @param int $permissions
253
-	 * @return bool
254
-	 */
255
-	protected function checkPermissions($permissions) {
256
-		return ($this->getPermissions() & $permissions) === $permissions;
257
-	}
258
-
259
-	/**
260
-	 * @return bool
261
-	 */
262
-	public function isReadable() {
263
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
264
-	}
265
-
266
-	/**
267
-	 * @return bool
268
-	 */
269
-	public function isUpdateable() {
270
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
271
-	}
272
-
273
-	/**
274
-	 * Check whether new files or folders can be created inside this folder
275
-	 *
276
-	 * @return bool
277
-	 */
278
-	public function isCreatable() {
279
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
280
-	}
281
-
282
-	/**
283
-	 * @return bool
284
-	 */
285
-	public function isDeletable() {
286
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
287
-	}
288
-
289
-	/**
290
-	 * @return bool
291
-	 */
292
-	public function isShareable() {
293
-		return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
294
-	}
295
-
296
-	/**
297
-	 * Check if a file or folder is shared
298
-	 *
299
-	 * @return bool
300
-	 */
301
-	public function isShared() {
302
-		$sid = $this->getStorage()->getId();
303
-		if (!is_null($sid)) {
304
-			$sid = explode(':', $sid);
305
-			return ($sid[0] === 'shared');
306
-		}
307
-
308
-		return false;
309
-	}
310
-
311
-	public function isMounted() {
312
-		$storage = $this->getStorage();
313
-		if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
314
-			return false;
315
-		}
316
-		$sid = $storage->getId();
317
-		if (!is_null($sid)) {
318
-			$sid = explode(':', $sid);
319
-			return ($sid[0] !== 'home' and $sid[0] !== 'shared');
320
-		}
321
-
322
-		return false;
323
-	}
324
-
325
-	/**
326
-	 * Get the mountpoint the file belongs to
327
-	 *
328
-	 * @return \OCP\Files\Mount\IMountPoint
329
-	 */
330
-	public function getMountPoint() {
331
-		return $this->mount;
332
-	}
333
-
334
-	/**
335
-	 * Get the owner of the file
336
-	 *
337
-	 * @return \OCP\IUser
338
-	 */
339
-	public function getOwner() {
340
-		return $this->owner;
341
-	}
342
-
343
-	/**
344
-	 * @param IMountPoint[] $mounts
345
-	 */
346
-	public function setSubMounts(array $mounts) {
347
-		$this->subMounts = $mounts;
348
-	}
349
-
350
-	private function updateEntryfromSubMounts() {
351
-		if ($this->subMountsUsed) {
352
-			return;
353
-		}
354
-		$this->subMountsUsed = true;
355
-		foreach ($this->subMounts as $mount) {
356
-			$subStorage = $mount->getStorage();
357
-			if ($subStorage) {
358
-				$subCache = $subStorage->getCache('');
359
-				$rootEntry = $subCache->get('');
360
-				$this->addSubEntry($rootEntry, $mount->getMountPoint());
361
-			}
362
-		}
363
-	}
364
-
365
-	/**
366
-	 * Add a cache entry which is the child of this folder
367
-	 *
368
-	 * Sets the size, etag and size to for cross-storage childs
369
-	 *
370
-	 * @param array|ICacheEntry $data cache entry for the child
371
-	 * @param string $entryPath full path of the child entry
372
-	 */
373
-	public function addSubEntry($data, $entryPath) {
374
-		$this->data['size'] += isset($data['size']) ? $data['size'] : 0;
375
-		if (isset($data['mtime'])) {
376
-			$this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
377
-		}
378
-		if (isset($data['etag'])) {
379
-			// prefix the etag with the relative path of the subentry to propagate etag on mount moves
380
-			$relativeEntryPath = substr($entryPath, strlen($this->getPath()));
381
-			// attach the permissions to propagate etag on permision changes of submounts
382
-			$permissions = isset($data['permissions']) ? $data['permissions'] : 0;
383
-			$this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
384
-		}
385
-	}
386
-
387
-	/**
388
-	 * @inheritdoc
389
-	 */
390
-	public function getChecksum() {
391
-		return $this->data['checksum'];
392
-	}
393
-
394
-	public function getExtension(): string {
395
-		return pathinfo($this->getName(), PATHINFO_EXTENSION);
396
-	}
41
+    /**
42
+     * @var array $data
43
+     */
44
+    private $data;
45
+
46
+    /**
47
+     * @var string $path
48
+     */
49
+    private $path;
50
+
51
+    /**
52
+     * @var \OC\Files\Storage\Storage $storage
53
+     */
54
+    private $storage;
55
+
56
+    /**
57
+     * @var string $internalPath
58
+     */
59
+    private $internalPath;
60
+
61
+    /**
62
+     * @var \OCP\Files\Mount\IMountPoint
63
+     */
64
+    private $mount;
65
+
66
+    /**
67
+     * @var IUser
68
+     */
69
+    private $owner;
70
+
71
+    /**
72
+     * @var string[]
73
+     */
74
+    private $childEtags = [];
75
+
76
+    /**
77
+     * @var IMountPoint[]
78
+     */
79
+    private $subMounts = [];
80
+
81
+    private $subMountsUsed = false;
82
+
83
+    /**
84
+     * @param string|boolean $path
85
+     * @param Storage\Storage $storage
86
+     * @param string $internalPath
87
+     * @param array|ICacheEntry $data
88
+     * @param \OCP\Files\Mount\IMountPoint $mount
89
+     * @param \OCP\IUser|null $owner
90
+     */
91
+    public function __construct($path, $storage, $internalPath, $data, $mount, $owner= null) {
92
+        $this->path = $path;
93
+        $this->storage = $storage;
94
+        $this->internalPath = $internalPath;
95
+        $this->data = $data;
96
+        $this->mount = $mount;
97
+        $this->owner = $owner;
98
+    }
99
+
100
+    public function offsetSet($offset, $value) {
101
+        $this->data[$offset] = $value;
102
+    }
103
+
104
+    public function offsetExists($offset) {
105
+        return isset($this->data[$offset]);
106
+    }
107
+
108
+    public function offsetUnset($offset) {
109
+        unset($this->data[$offset]);
110
+    }
111
+
112
+    public function offsetGet($offset) {
113
+        if ($offset === 'type') {
114
+            return $this->getType();
115
+        } else if ($offset === 'etag') {
116
+            return $this->getEtag();
117
+        } else if ($offset === 'size') {
118
+            return $this->getSize();
119
+        } else if ($offset === 'mtime') {
120
+            return $this->getMTime();
121
+        } elseif ($offset === 'permissions') {
122
+            return $this->getPermissions();
123
+        } elseif (isset($this->data[$offset])) {
124
+            return $this->data[$offset];
125
+        } else {
126
+            return null;
127
+        }
128
+    }
129
+
130
+    /**
131
+     * @return string
132
+     */
133
+    public function getPath() {
134
+        return $this->path;
135
+    }
136
+
137
+    /**
138
+     * @return \OCP\Files\Storage
139
+     */
140
+    public function getStorage() {
141
+        return $this->storage;
142
+    }
143
+
144
+    /**
145
+     * @return string
146
+     */
147
+    public function getInternalPath() {
148
+        return $this->internalPath;
149
+    }
150
+
151
+    /**
152
+     * Get FileInfo ID or null in case of part file
153
+     *
154
+     * @return int|null
155
+     */
156
+    public function getId() {
157
+        return isset($this->data['fileid']) ? (int)  $this->data['fileid'] : null;
158
+    }
159
+
160
+    /**
161
+     * @return string
162
+     */
163
+    public function getMimetype() {
164
+        return $this->data['mimetype'];
165
+    }
166
+
167
+    /**
168
+     * @return string
169
+     */
170
+    public function getMimePart() {
171
+        return $this->data['mimepart'];
172
+    }
173
+
174
+    /**
175
+     * @return string
176
+     */
177
+    public function getName() {
178
+        return isset($this->data['name']) ? $this->data['name'] : basename($this->getPath());
179
+    }
180
+
181
+    /**
182
+     * @return string
183
+     */
184
+    public function getEtag() {
185
+        $this->updateEntryfromSubMounts();
186
+        if (count($this->childEtags) > 0) {
187
+            $combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
188
+            return md5($combinedEtag);
189
+        } else {
190
+            return $this->data['etag'];
191
+        }
192
+    }
193
+
194
+    /**
195
+     * @return int
196
+     */
197
+    public function getSize() {
198
+        $this->updateEntryfromSubMounts();
199
+        return isset($this->data['size']) ? 0 + $this->data['size'] : 0;
200
+    }
201
+
202
+    /**
203
+     * @return int
204
+     */
205
+    public function getMTime() {
206
+        $this->updateEntryfromSubMounts();
207
+        return (int) $this->data['mtime'];
208
+    }
209
+
210
+    /**
211
+     * @return bool
212
+     */
213
+    public function isEncrypted() {
214
+        return $this->data['encrypted'];
215
+    }
216
+
217
+    /**
218
+     * Return the currently version used for the HMAC in the encryption app
219
+     *
220
+     * @return int
221
+     */
222
+    public function getEncryptedVersion() {
223
+        return isset($this->data['encryptedVersion']) ? (int) $this->data['encryptedVersion'] : 1;
224
+    }
225
+
226
+    /**
227
+     * @return int
228
+     */
229
+    public function getPermissions() {
230
+        $perms = (int) $this->data['permissions'];
231
+        if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) {
232
+            $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE;
233
+        }
234
+        return (int) $perms;
235
+    }
236
+
237
+    /**
238
+     * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
239
+     */
240
+    public function getType() {
241
+        if (!isset($this->data['type'])) {
242
+            $this->data['type'] = ($this->getMimetype() === 'httpd/unix-directory') ? self::TYPE_FOLDER : self::TYPE_FILE;
243
+        }
244
+        return $this->data['type'];
245
+    }
246
+
247
+    public function getData() {
248
+        return $this->data;
249
+    }
250
+
251
+    /**
252
+     * @param int $permissions
253
+     * @return bool
254
+     */
255
+    protected function checkPermissions($permissions) {
256
+        return ($this->getPermissions() & $permissions) === $permissions;
257
+    }
258
+
259
+    /**
260
+     * @return bool
261
+     */
262
+    public function isReadable() {
263
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
264
+    }
265
+
266
+    /**
267
+     * @return bool
268
+     */
269
+    public function isUpdateable() {
270
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
271
+    }
272
+
273
+    /**
274
+     * Check whether new files or folders can be created inside this folder
275
+     *
276
+     * @return bool
277
+     */
278
+    public function isCreatable() {
279
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
280
+    }
281
+
282
+    /**
283
+     * @return bool
284
+     */
285
+    public function isDeletable() {
286
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
287
+    }
288
+
289
+    /**
290
+     * @return bool
291
+     */
292
+    public function isShareable() {
293
+        return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
294
+    }
295
+
296
+    /**
297
+     * Check if a file or folder is shared
298
+     *
299
+     * @return bool
300
+     */
301
+    public function isShared() {
302
+        $sid = $this->getStorage()->getId();
303
+        if (!is_null($sid)) {
304
+            $sid = explode(':', $sid);
305
+            return ($sid[0] === 'shared');
306
+        }
307
+
308
+        return false;
309
+    }
310
+
311
+    public function isMounted() {
312
+        $storage = $this->getStorage();
313
+        if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) {
314
+            return false;
315
+        }
316
+        $sid = $storage->getId();
317
+        if (!is_null($sid)) {
318
+            $sid = explode(':', $sid);
319
+            return ($sid[0] !== 'home' and $sid[0] !== 'shared');
320
+        }
321
+
322
+        return false;
323
+    }
324
+
325
+    /**
326
+     * Get the mountpoint the file belongs to
327
+     *
328
+     * @return \OCP\Files\Mount\IMountPoint
329
+     */
330
+    public function getMountPoint() {
331
+        return $this->mount;
332
+    }
333
+
334
+    /**
335
+     * Get the owner of the file
336
+     *
337
+     * @return \OCP\IUser
338
+     */
339
+    public function getOwner() {
340
+        return $this->owner;
341
+    }
342
+
343
+    /**
344
+     * @param IMountPoint[] $mounts
345
+     */
346
+    public function setSubMounts(array $mounts) {
347
+        $this->subMounts = $mounts;
348
+    }
349
+
350
+    private function updateEntryfromSubMounts() {
351
+        if ($this->subMountsUsed) {
352
+            return;
353
+        }
354
+        $this->subMountsUsed = true;
355
+        foreach ($this->subMounts as $mount) {
356
+            $subStorage = $mount->getStorage();
357
+            if ($subStorage) {
358
+                $subCache = $subStorage->getCache('');
359
+                $rootEntry = $subCache->get('');
360
+                $this->addSubEntry($rootEntry, $mount->getMountPoint());
361
+            }
362
+        }
363
+    }
364
+
365
+    /**
366
+     * Add a cache entry which is the child of this folder
367
+     *
368
+     * Sets the size, etag and size to for cross-storage childs
369
+     *
370
+     * @param array|ICacheEntry $data cache entry for the child
371
+     * @param string $entryPath full path of the child entry
372
+     */
373
+    public function addSubEntry($data, $entryPath) {
374
+        $this->data['size'] += isset($data['size']) ? $data['size'] : 0;
375
+        if (isset($data['mtime'])) {
376
+            $this->data['mtime'] = max($this->data['mtime'], $data['mtime']);
377
+        }
378
+        if (isset($data['etag'])) {
379
+            // prefix the etag with the relative path of the subentry to propagate etag on mount moves
380
+            $relativeEntryPath = substr($entryPath, strlen($this->getPath()));
381
+            // attach the permissions to propagate etag on permision changes of submounts
382
+            $permissions = isset($data['permissions']) ? $data['permissions'] : 0;
383
+            $this->childEtags[] = $relativeEntryPath . '/' . $data['etag'] . $permissions;
384
+        }
385
+    }
386
+
387
+    /**
388
+     * @inheritdoc
389
+     */
390
+    public function getChecksum() {
391
+        return $this->data['checksum'];
392
+    }
393
+
394
+    public function getExtension(): string {
395
+        return pathinfo($this->getName(), PATHINFO_EXTENSION);
396
+    }
397 397
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trash/TrashItem.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -25,152 +25,152 @@
 block discarded – undo
25 25
 use OCP\IUser;
26 26
 
27 27
 class TrashItem implements ITrashItem {
28
-	/** @var ITrashBackend */
29
-	private $backend;
30
-	/** @var string */
31
-	private $orignalLocation;
32
-	/** @var int */
33
-	private $deletedTime;
34
-	/** @var string */
35
-	private $trashPath;
36
-	/** @var FileInfo */
37
-	private $fileInfo;
38
-	/** @var IUser */
39
-	private $user;
40
-
41
-	public function __construct(
42
-		ITrashBackend $backend,
43
-		string $originalLocation,
44
-		int $deletedTime,
45
-		string $trashPath,
46
-		FileInfo $fileInfo,
47
-		IUser $user
48
-	) {
49
-		$this->backend = $backend;
50
-		$this->orignalLocation = $originalLocation;
51
-		$this->deletedTime = $deletedTime;
52
-		$this->trashPath = $trashPath;
53
-		$this->fileInfo = $fileInfo;
54
-		$this->user = $user;
55
-	}
56
-
57
-	public function getTrashBackend(): ITrashBackend {
58
-		return $this->backend;
59
-	}
60
-
61
-	public function getOriginalLocation(): string {
62
-		return $this->orignalLocation;
63
-	}
64
-
65
-	public function getDeletedTime(): int {
66
-		return $this->deletedTime;
67
-	}
68
-
69
-	public function getTrashPath(): string {
70
-		return $this->trashPath;
71
-	}
72
-
73
-	public function isRootItem(): bool {
74
-		return substr_count($this->getTrashPath(), '/') === 1;
75
-	}
76
-
77
-	public function getUser(): IUser {
78
-		return $this->user;
79
-	}
80
-
81
-	public function getEtag() {
82
-		return $this->fileInfo->getEtag();
83
-	}
84
-
85
-	public function getSize() {
86
-		return $this->fileInfo->getSize();
87
-	}
88
-
89
-	public function getMtime() {
90
-		return $this->fileInfo->getMtime();
91
-	}
92
-
93
-	public function getName() {
94
-		return $this->fileInfo->getName();
95
-	}
96
-
97
-	public function getInternalPath() {
98
-		return $this->fileInfo->getInternalPath();
99
-	}
100
-
101
-	public function getPath() {
102
-		return $this->fileInfo->getPath();
103
-	}
104
-
105
-	public function getMimetype() {
106
-		return $this->fileInfo->getMimetype();
107
-	}
108
-
109
-	public function getMimePart() {
110
-		return $this->fileInfo->getMimePart();
111
-	}
112
-
113
-	public function getStorage() {
114
-		return $this->fileInfo->getStorage();
115
-	}
116
-
117
-	public function getId() {
118
-		return $this->fileInfo->getId();
119
-	}
120
-
121
-	public function isEncrypted() {
122
-		return $this->fileInfo->isEncrypted();
123
-	}
124
-
125
-	public function getPermissions() {
126
-		return $this->fileInfo->getPermissions();
127
-	}
128
-
129
-	public function getType() {
130
-		return $this->fileInfo->getType();
131
-	}
132
-
133
-	public function isReadable() {
134
-		return $this->fileInfo->isReadable();
135
-	}
28
+    /** @var ITrashBackend */
29
+    private $backend;
30
+    /** @var string */
31
+    private $orignalLocation;
32
+    /** @var int */
33
+    private $deletedTime;
34
+    /** @var string */
35
+    private $trashPath;
36
+    /** @var FileInfo */
37
+    private $fileInfo;
38
+    /** @var IUser */
39
+    private $user;
40
+
41
+    public function __construct(
42
+        ITrashBackend $backend,
43
+        string $originalLocation,
44
+        int $deletedTime,
45
+        string $trashPath,
46
+        FileInfo $fileInfo,
47
+        IUser $user
48
+    ) {
49
+        $this->backend = $backend;
50
+        $this->orignalLocation = $originalLocation;
51
+        $this->deletedTime = $deletedTime;
52
+        $this->trashPath = $trashPath;
53
+        $this->fileInfo = $fileInfo;
54
+        $this->user = $user;
55
+    }
56
+
57
+    public function getTrashBackend(): ITrashBackend {
58
+        return $this->backend;
59
+    }
60
+
61
+    public function getOriginalLocation(): string {
62
+        return $this->orignalLocation;
63
+    }
64
+
65
+    public function getDeletedTime(): int {
66
+        return $this->deletedTime;
67
+    }
68
+
69
+    public function getTrashPath(): string {
70
+        return $this->trashPath;
71
+    }
72
+
73
+    public function isRootItem(): bool {
74
+        return substr_count($this->getTrashPath(), '/') === 1;
75
+    }
76
+
77
+    public function getUser(): IUser {
78
+        return $this->user;
79
+    }
80
+
81
+    public function getEtag() {
82
+        return $this->fileInfo->getEtag();
83
+    }
84
+
85
+    public function getSize() {
86
+        return $this->fileInfo->getSize();
87
+    }
88
+
89
+    public function getMtime() {
90
+        return $this->fileInfo->getMtime();
91
+    }
92
+
93
+    public function getName() {
94
+        return $this->fileInfo->getName();
95
+    }
96
+
97
+    public function getInternalPath() {
98
+        return $this->fileInfo->getInternalPath();
99
+    }
100
+
101
+    public function getPath() {
102
+        return $this->fileInfo->getPath();
103
+    }
104
+
105
+    public function getMimetype() {
106
+        return $this->fileInfo->getMimetype();
107
+    }
108
+
109
+    public function getMimePart() {
110
+        return $this->fileInfo->getMimePart();
111
+    }
112
+
113
+    public function getStorage() {
114
+        return $this->fileInfo->getStorage();
115
+    }
116
+
117
+    public function getId() {
118
+        return $this->fileInfo->getId();
119
+    }
120
+
121
+    public function isEncrypted() {
122
+        return $this->fileInfo->isEncrypted();
123
+    }
124
+
125
+    public function getPermissions() {
126
+        return $this->fileInfo->getPermissions();
127
+    }
128
+
129
+    public function getType() {
130
+        return $this->fileInfo->getType();
131
+    }
132
+
133
+    public function isReadable() {
134
+        return $this->fileInfo->isReadable();
135
+    }
136 136
 	
137
-	public function isUpdateable() {
138
-		return $this->fileInfo->isUpdateable();
139
-	}
137
+    public function isUpdateable() {
138
+        return $this->fileInfo->isUpdateable();
139
+    }
140 140
 
141
-	public function isCreatable() {
142
-		return $this->fileInfo->isCreatable();
143
-	}
141
+    public function isCreatable() {
142
+        return $this->fileInfo->isCreatable();
143
+    }
144 144
 
145
-	public function isDeletable() {
146
-		return $this->fileInfo->isDeletable();
147
-	}
145
+    public function isDeletable() {
146
+        return $this->fileInfo->isDeletable();
147
+    }
148 148
 
149
-	public function isShareable() {
150
-		return $this->fileInfo->isShareable();
151
-	}
149
+    public function isShareable() {
150
+        return $this->fileInfo->isShareable();
151
+    }
152 152
 
153
-	public function isShared() {
154
-		return $this->fileInfo->isShared();
155
-	}
153
+    public function isShared() {
154
+        return $this->fileInfo->isShared();
155
+    }
156 156
 
157
-	public function isMounted() {
158
-		return $this->fileInfo->isMounted();
159
-	}
157
+    public function isMounted() {
158
+        return $this->fileInfo->isMounted();
159
+    }
160 160
 
161
-	public function getMountPoint() {
162
-		return $this->fileInfo->getMountPoint();
163
-	}
161
+    public function getMountPoint() {
162
+        return $this->fileInfo->getMountPoint();
163
+    }
164 164
 
165
-	public function getOwner() {
166
-		return $this->fileInfo->getOwner();
167
-	}
165
+    public function getOwner() {
166
+        return $this->fileInfo->getOwner();
167
+    }
168 168
 
169
-	public function getChecksum() {
170
-		return $this->fileInfo->getChecksum();
171
-	}
169
+    public function getChecksum() {
170
+        return $this->fileInfo->getChecksum();
171
+    }
172 172
 
173
-	public function getExtension(): string {
174
-		return $this->fileInfo->getExtension();
175
-	}
173
+    public function getExtension(): string {
174
+        return $this->fileInfo->getExtension();
175
+    }
176 176
 }
Please login to merge, or discard this patch.