@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Files_Sharing\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\Files_Sharing\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -33,229 +33,229 @@ |
||
33 | 33 | * @since 7.0.0 |
34 | 34 | */ |
35 | 35 | interface FileInfo { |
36 | - /** |
|
37 | - * @since 7.0.0 |
|
38 | - */ |
|
39 | - const TYPE_FILE = 'file'; |
|
40 | - /** |
|
41 | - * @since 7.0.0 |
|
42 | - */ |
|
43 | - const TYPE_FOLDER = 'dir'; |
|
36 | + /** |
|
37 | + * @since 7.0.0 |
|
38 | + */ |
|
39 | + const TYPE_FILE = 'file'; |
|
40 | + /** |
|
41 | + * @since 7.0.0 |
|
42 | + */ |
|
43 | + const TYPE_FOLDER = 'dir'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
47 | - * @since 8.0.0 |
|
48 | - */ |
|
49 | - const SPACE_NOT_COMPUTED = -1; |
|
50 | - /** |
|
51 | - * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
52 | - * @since 8.0.0 |
|
53 | - */ |
|
54 | - const SPACE_UNKNOWN = -2; |
|
55 | - /** |
|
56 | - * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
57 | - * @since 8.0.0 |
|
58 | - */ |
|
59 | - const SPACE_UNLIMITED = -3; |
|
45 | + /** |
|
46 | + * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
47 | + * @since 8.0.0 |
|
48 | + */ |
|
49 | + const SPACE_NOT_COMPUTED = -1; |
|
50 | + /** |
|
51 | + * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
52 | + * @since 8.0.0 |
|
53 | + */ |
|
54 | + const SPACE_UNKNOWN = -2; |
|
55 | + /** |
|
56 | + * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
57 | + * @since 8.0.0 |
|
58 | + */ |
|
59 | + const SPACE_UNLIMITED = -3; |
|
60 | 60 | |
61 | - /** |
|
62 | - * @since 9.1.0 |
|
63 | - */ |
|
64 | - const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
61 | + /** |
|
62 | + * @since 9.1.0 |
|
63 | + */ |
|
64 | + const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
65 | 65 | |
66 | - /** |
|
67 | - * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
68 | - * @since 12.0.0 |
|
69 | - */ |
|
70 | - const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
66 | + /** |
|
67 | + * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
68 | + * @since 12.0.0 |
|
69 | + */ |
|
70 | + const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
71 | 71 | |
72 | - /** |
|
73 | - * Get the Etag of the file or folder |
|
74 | - * |
|
75 | - * @return string |
|
76 | - * @since 7.0.0 |
|
77 | - */ |
|
78 | - public function getEtag(); |
|
72 | + /** |
|
73 | + * Get the Etag of the file or folder |
|
74 | + * |
|
75 | + * @return string |
|
76 | + * @since 7.0.0 |
|
77 | + */ |
|
78 | + public function getEtag(); |
|
79 | 79 | |
80 | - /** |
|
81 | - * Get the size in bytes for the file or folder |
|
82 | - * |
|
83 | - * @return int |
|
84 | - * @since 7.0.0 |
|
85 | - */ |
|
86 | - public function getSize(); |
|
80 | + /** |
|
81 | + * Get the size in bytes for the file or folder |
|
82 | + * |
|
83 | + * @return int |
|
84 | + * @since 7.0.0 |
|
85 | + */ |
|
86 | + public function getSize(); |
|
87 | 87 | |
88 | - /** |
|
89 | - * Get the last modified date as timestamp for the file or folder |
|
90 | - * |
|
91 | - * @return int |
|
92 | - * @since 7.0.0 |
|
93 | - */ |
|
94 | - public function getMtime(); |
|
88 | + /** |
|
89 | + * Get the last modified date as timestamp for the file or folder |
|
90 | + * |
|
91 | + * @return int |
|
92 | + * @since 7.0.0 |
|
93 | + */ |
|
94 | + public function getMtime(); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Get the name of the file or folder |
|
98 | - * |
|
99 | - * @return string |
|
100 | - * @since 7.0.0 |
|
101 | - */ |
|
102 | - public function getName(); |
|
96 | + /** |
|
97 | + * Get the name of the file or folder |
|
98 | + * |
|
99 | + * @return string |
|
100 | + * @since 7.0.0 |
|
101 | + */ |
|
102 | + public function getName(); |
|
103 | 103 | |
104 | - /** |
|
105 | - * Get the path relative to the storage |
|
106 | - * |
|
107 | - * @return string |
|
108 | - * @since 7.0.0 |
|
109 | - */ |
|
110 | - public function getInternalPath(); |
|
104 | + /** |
|
105 | + * Get the path relative to the storage |
|
106 | + * |
|
107 | + * @return string |
|
108 | + * @since 7.0.0 |
|
109 | + */ |
|
110 | + public function getInternalPath(); |
|
111 | 111 | |
112 | - /** |
|
113 | - * Get the absolute path |
|
114 | - * |
|
115 | - * @return string |
|
116 | - * @since 7.0.0 |
|
117 | - */ |
|
118 | - public function getPath(); |
|
112 | + /** |
|
113 | + * Get the absolute path |
|
114 | + * |
|
115 | + * @return string |
|
116 | + * @since 7.0.0 |
|
117 | + */ |
|
118 | + public function getPath(); |
|
119 | 119 | |
120 | - /** |
|
121 | - * Get the full mimetype of the file or folder i.e. 'image/png' |
|
122 | - * |
|
123 | - * @return string |
|
124 | - * @since 7.0.0 |
|
125 | - */ |
|
126 | - public function getMimetype(); |
|
120 | + /** |
|
121 | + * Get the full mimetype of the file or folder i.e. 'image/png' |
|
122 | + * |
|
123 | + * @return string |
|
124 | + * @since 7.0.0 |
|
125 | + */ |
|
126 | + public function getMimetype(); |
|
127 | 127 | |
128 | - /** |
|
129 | - * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
130 | - * |
|
131 | - * @return string |
|
132 | - * @since 7.0.0 |
|
133 | - */ |
|
134 | - public function getMimePart(); |
|
128 | + /** |
|
129 | + * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
130 | + * |
|
131 | + * @return string |
|
132 | + * @since 7.0.0 |
|
133 | + */ |
|
134 | + public function getMimePart(); |
|
135 | 135 | |
136 | - /** |
|
137 | - * Get the storage the file or folder is storage on |
|
138 | - * |
|
139 | - * @return \OCP\Files\Storage |
|
140 | - * @since 7.0.0 |
|
141 | - */ |
|
142 | - public function getStorage(); |
|
136 | + /** |
|
137 | + * Get the storage the file or folder is storage on |
|
138 | + * |
|
139 | + * @return \OCP\Files\Storage |
|
140 | + * @since 7.0.0 |
|
141 | + */ |
|
142 | + public function getStorage(); |
|
143 | 143 | |
144 | - /** |
|
145 | - * Get the file id of the file or folder |
|
146 | - * |
|
147 | - * @return int|null |
|
148 | - * @since 7.0.0 |
|
149 | - */ |
|
150 | - public function getId(); |
|
144 | + /** |
|
145 | + * Get the file id of the file or folder |
|
146 | + * |
|
147 | + * @return int|null |
|
148 | + * @since 7.0.0 |
|
149 | + */ |
|
150 | + public function getId(); |
|
151 | 151 | |
152 | - /** |
|
153 | - * Check whether the file is encrypted |
|
154 | - * |
|
155 | - * @return bool |
|
156 | - * @since 7.0.0 |
|
157 | - */ |
|
158 | - public function isEncrypted(); |
|
152 | + /** |
|
153 | + * Check whether the file is encrypted |
|
154 | + * |
|
155 | + * @return bool |
|
156 | + * @since 7.0.0 |
|
157 | + */ |
|
158 | + public function isEncrypted(); |
|
159 | 159 | |
160 | - /** |
|
161 | - * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
162 | - * \OCP\Constants::PERMISSION_CREATE |
|
163 | - * \OCP\Constants::PERMISSION_READ |
|
164 | - * \OCP\Constants::PERMISSION_UPDATE |
|
165 | - * \OCP\Constants::PERMISSION_DELETE |
|
166 | - * \OCP\Constants::PERMISSION_SHARE |
|
167 | - * \OCP\Constants::PERMISSION_ALL |
|
168 | - * |
|
169 | - * @return int |
|
170 | - * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
171 | - */ |
|
172 | - public function getPermissions(); |
|
160 | + /** |
|
161 | + * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
162 | + * \OCP\Constants::PERMISSION_CREATE |
|
163 | + * \OCP\Constants::PERMISSION_READ |
|
164 | + * \OCP\Constants::PERMISSION_UPDATE |
|
165 | + * \OCP\Constants::PERMISSION_DELETE |
|
166 | + * \OCP\Constants::PERMISSION_SHARE |
|
167 | + * \OCP\Constants::PERMISSION_ALL |
|
168 | + * |
|
169 | + * @return int |
|
170 | + * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
171 | + */ |
|
172 | + public function getPermissions(); |
|
173 | 173 | |
174 | - /** |
|
175 | - * Check whether this is a file or a folder |
|
176 | - * |
|
177 | - * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
178 | - * @since 7.0.0 |
|
179 | - */ |
|
180 | - public function getType(); |
|
174 | + /** |
|
175 | + * Check whether this is a file or a folder |
|
176 | + * |
|
177 | + * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
178 | + * @since 7.0.0 |
|
179 | + */ |
|
180 | + public function getType(); |
|
181 | 181 | |
182 | - /** |
|
183 | - * Check if the file or folder is readable |
|
184 | - * |
|
185 | - * @return bool |
|
186 | - * @since 7.0.0 |
|
187 | - */ |
|
188 | - public function isReadable(); |
|
182 | + /** |
|
183 | + * Check if the file or folder is readable |
|
184 | + * |
|
185 | + * @return bool |
|
186 | + * @since 7.0.0 |
|
187 | + */ |
|
188 | + public function isReadable(); |
|
189 | 189 | |
190 | - /** |
|
191 | - * Check if a file is writable |
|
192 | - * |
|
193 | - * @return bool |
|
194 | - * @since 7.0.0 |
|
195 | - */ |
|
196 | - public function isUpdateable(); |
|
190 | + /** |
|
191 | + * Check if a file is writable |
|
192 | + * |
|
193 | + * @return bool |
|
194 | + * @since 7.0.0 |
|
195 | + */ |
|
196 | + public function isUpdateable(); |
|
197 | 197 | |
198 | - /** |
|
199 | - * Check whether new files or folders can be created inside this folder |
|
200 | - * |
|
201 | - * @return bool |
|
202 | - * @since 8.0.0 |
|
203 | - */ |
|
204 | - public function isCreatable(); |
|
198 | + /** |
|
199 | + * Check whether new files or folders can be created inside this folder |
|
200 | + * |
|
201 | + * @return bool |
|
202 | + * @since 8.0.0 |
|
203 | + */ |
|
204 | + public function isCreatable(); |
|
205 | 205 | |
206 | - /** |
|
207 | - * Check if a file or folder can be deleted |
|
208 | - * |
|
209 | - * @return bool |
|
210 | - * @since 7.0.0 |
|
211 | - */ |
|
212 | - public function isDeletable(); |
|
206 | + /** |
|
207 | + * Check if a file or folder can be deleted |
|
208 | + * |
|
209 | + * @return bool |
|
210 | + * @since 7.0.0 |
|
211 | + */ |
|
212 | + public function isDeletable(); |
|
213 | 213 | |
214 | - /** |
|
215 | - * Check if a file or folder can be shared |
|
216 | - * |
|
217 | - * @return bool |
|
218 | - * @since 7.0.0 |
|
219 | - */ |
|
220 | - public function isShareable(); |
|
214 | + /** |
|
215 | + * Check if a file or folder can be shared |
|
216 | + * |
|
217 | + * @return bool |
|
218 | + * @since 7.0.0 |
|
219 | + */ |
|
220 | + public function isShareable(); |
|
221 | 221 | |
222 | - /** |
|
223 | - * Check if a file or folder is shared |
|
224 | - * |
|
225 | - * @return bool |
|
226 | - * @since 7.0.0 |
|
227 | - */ |
|
228 | - public function isShared(); |
|
222 | + /** |
|
223 | + * Check if a file or folder is shared |
|
224 | + * |
|
225 | + * @return bool |
|
226 | + * @since 7.0.0 |
|
227 | + */ |
|
228 | + public function isShared(); |
|
229 | 229 | |
230 | - /** |
|
231 | - * Check if a file or folder is mounted |
|
232 | - * |
|
233 | - * @return bool |
|
234 | - * @since 7.0.0 |
|
235 | - */ |
|
236 | - public function isMounted(); |
|
230 | + /** |
|
231 | + * Check if a file or folder is mounted |
|
232 | + * |
|
233 | + * @return bool |
|
234 | + * @since 7.0.0 |
|
235 | + */ |
|
236 | + public function isMounted(); |
|
237 | 237 | |
238 | - /** |
|
239 | - * Get the mountpoint the file belongs to |
|
240 | - * |
|
241 | - * @return \OCP\Files\Mount\IMountPoint |
|
242 | - * @since 8.0.0 |
|
243 | - */ |
|
244 | - public function getMountPoint(); |
|
238 | + /** |
|
239 | + * Get the mountpoint the file belongs to |
|
240 | + * |
|
241 | + * @return \OCP\Files\Mount\IMountPoint |
|
242 | + * @since 8.0.0 |
|
243 | + */ |
|
244 | + public function getMountPoint(); |
|
245 | 245 | |
246 | - /** |
|
247 | - * Get the owner of the file |
|
248 | - * |
|
249 | - * @return \OCP\IUser |
|
250 | - * @since 9.0.0 |
|
251 | - */ |
|
252 | - public function getOwner(); |
|
246 | + /** |
|
247 | + * Get the owner of the file |
|
248 | + * |
|
249 | + * @return \OCP\IUser |
|
250 | + * @since 9.0.0 |
|
251 | + */ |
|
252 | + public function getOwner(); |
|
253 | 253 | |
254 | - /** |
|
255 | - * Get the stored checksum for this file |
|
256 | - * |
|
257 | - * @return string |
|
258 | - * @since 9.0.0 |
|
259 | - */ |
|
260 | - public function getChecksum(); |
|
254 | + /** |
|
255 | + * Get the stored checksum for this file |
|
256 | + * |
|
257 | + * @return string |
|
258 | + * @since 9.0.0 |
|
259 | + */ |
|
260 | + public function getChecksum(); |
|
261 | 261 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * appending or prepending to the ones previously set for this namespace. |
149 | 149 | * |
150 | 150 | * @param string $prefix The prefix/namespace, with trailing '\\' |
151 | - * @param array|string $paths The PSR-4 base directories |
|
151 | + * @param string $paths The PSR-4 base directories |
|
152 | 152 | * @param bool $prepend Whether to prepend the directories |
153 | 153 | * |
154 | 154 | * @throws \InvalidArgumentException |
@@ -367,6 +367,10 @@ discard block |
||
367 | 367 | return $file; |
368 | 368 | } |
369 | 369 | |
370 | + /** |
|
371 | + * @param string $class |
|
372 | + * @param string $ext |
|
373 | + */ |
|
370 | 374 | private function findFileWithExtension($class, $ext) |
371 | 375 | { |
372 | 376 | // PSR-4 lookup |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * appending or prepending to the ones previously set for this namespace. |
149 | 149 | * |
150 | 150 | * @param string $prefix The prefix/namespace, with trailing '\\' |
151 | - * @param array|string $paths The PSR-4 base directories |
|
151 | + * @param string $paths The PSR-4 base directories |
|
152 | 152 | * @param bool $prepend Whether to prepend the directories |
153 | 153 | * |
154 | 154 | * @throws \InvalidArgumentException |
@@ -367,6 +367,10 @@ discard block |
||
367 | 367 | return $file; |
368 | 368 | } |
369 | 369 | |
370 | + /** |
|
371 | + * @param string $class |
|
372 | + * @param string $ext |
|
373 | + */ |
|
370 | 374 | private function findFileWithExtension($class, $ext) |
371 | 375 | { |
372 | 376 | // PSR-4 lookup |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * appending or prepending to the ones previously set for this namespace. |
149 | 149 | * |
150 | 150 | * @param string $prefix The prefix/namespace, with trailing '\\' |
151 | - * @param array|string $paths The PSR-4 base directories |
|
151 | + * @param string $paths The PSR-4 base directories |
|
152 | 152 | * @param bool $prepend Whether to prepend the directories |
153 | 153 | * |
154 | 154 | * @throws \InvalidArgumentException |
@@ -367,6 +367,10 @@ discard block |
||
367 | 367 | return $file; |
368 | 368 | } |
369 | 369 | |
370 | + /** |
|
371 | + * @param string $class |
|
372 | + * @param string $ext |
|
373 | + */ |
|
370 | 374 | private function findFileWithExtension($class, $ext) |
371 | 375 | { |
372 | 376 | // PSR-4 lookup |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\AdminAudit\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\AdminAudit\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\DAV\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\DAV\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Comments\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\Comments\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | * @param array $body |
57 | 57 | * @param array $query |
58 | 58 | * @param array $headers |
59 | - * @return resource|string |
|
59 | + * @return string |
|
60 | 60 | * @throws \InvalidArgumentException |
61 | 61 | */ |
62 | 62 | protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { |
@@ -26,72 +26,72 @@ |
||
26 | 26 | use OCP\Remote\IInstance; |
27 | 27 | |
28 | 28 | class ApiBase { |
29 | - /** @var IInstance */ |
|
30 | - private $instance; |
|
31 | - /** @var ICredentials */ |
|
32 | - private $credentials; |
|
33 | - /** @var IClientService */ |
|
34 | - private $clientService; |
|
29 | + /** @var IInstance */ |
|
30 | + private $instance; |
|
31 | + /** @var ICredentials */ |
|
32 | + private $credentials; |
|
33 | + /** @var IClientService */ |
|
34 | + private $clientService; |
|
35 | 35 | |
36 | - public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) { |
|
37 | - $this->instance = $instance; |
|
38 | - $this->credentials = $credentials; |
|
39 | - $this->clientService = $clientService; |
|
40 | - } |
|
36 | + public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) { |
|
37 | + $this->instance = $instance; |
|
38 | + $this->credentials = $credentials; |
|
39 | + $this->clientService = $clientService; |
|
40 | + } |
|
41 | 41 | |
42 | - protected function getHttpClient() { |
|
43 | - return $this->clientService->newClient(); |
|
44 | - } |
|
42 | + protected function getHttpClient() { |
|
43 | + return $this->clientService->newClient(); |
|
44 | + } |
|
45 | 45 | |
46 | - protected function addDefaultHeaders(array $headers) { |
|
47 | - return array_merge([ |
|
48 | - 'OCS-APIREQUEST' => 'true', |
|
49 | - 'Accept' => 'application/json' |
|
50 | - ], $headers); |
|
51 | - } |
|
46 | + protected function addDefaultHeaders(array $headers) { |
|
47 | + return array_merge([ |
|
48 | + 'OCS-APIREQUEST' => 'true', |
|
49 | + 'Accept' => 'application/json' |
|
50 | + ], $headers); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param string $method |
|
55 | - * @param string $url |
|
56 | - * @param array $body |
|
57 | - * @param array $query |
|
58 | - * @param array $headers |
|
59 | - * @return resource|string |
|
60 | - * @throws \InvalidArgumentException |
|
61 | - */ |
|
62 | - protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { |
|
63 | - $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url; |
|
64 | - $options = [ |
|
65 | - 'query' => $query, |
|
66 | - 'headers' => $this->addDefaultHeaders($headers), |
|
67 | - 'auth' => [$this->credentials->getUsername(), $this->credentials->getPassword()] |
|
68 | - ]; |
|
69 | - if ($body) { |
|
70 | - $options['body'] = $body; |
|
71 | - } |
|
53 | + /** |
|
54 | + * @param string $method |
|
55 | + * @param string $url |
|
56 | + * @param array $body |
|
57 | + * @param array $query |
|
58 | + * @param array $headers |
|
59 | + * @return resource|string |
|
60 | + * @throws \InvalidArgumentException |
|
61 | + */ |
|
62 | + protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { |
|
63 | + $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url; |
|
64 | + $options = [ |
|
65 | + 'query' => $query, |
|
66 | + 'headers' => $this->addDefaultHeaders($headers), |
|
67 | + 'auth' => [$this->credentials->getUsername(), $this->credentials->getPassword()] |
|
68 | + ]; |
|
69 | + if ($body) { |
|
70 | + $options['body'] = $body; |
|
71 | + } |
|
72 | 72 | |
73 | - $client = $this->getHttpClient(); |
|
73 | + $client = $this->getHttpClient(); |
|
74 | 74 | |
75 | - switch ($method) { |
|
76 | - case 'get': |
|
77 | - $response = $client->get($fullUrl, $options); |
|
78 | - break; |
|
79 | - case 'post': |
|
80 | - $response = $client->post($fullUrl, $options); |
|
81 | - break; |
|
82 | - case 'put': |
|
83 | - $response = $client->put($fullUrl, $options); |
|
84 | - break; |
|
85 | - case 'delete': |
|
86 | - $response = $client->delete($fullUrl, $options); |
|
87 | - break; |
|
88 | - case 'options': |
|
89 | - $response = $client->options($fullUrl, $options); |
|
90 | - break; |
|
91 | - default: |
|
92 | - throw new \InvalidArgumentException('Invalid method ' . $method); |
|
93 | - } |
|
75 | + switch ($method) { |
|
76 | + case 'get': |
|
77 | + $response = $client->get($fullUrl, $options); |
|
78 | + break; |
|
79 | + case 'post': |
|
80 | + $response = $client->post($fullUrl, $options); |
|
81 | + break; |
|
82 | + case 'put': |
|
83 | + $response = $client->put($fullUrl, $options); |
|
84 | + break; |
|
85 | + case 'delete': |
|
86 | + $response = $client->delete($fullUrl, $options); |
|
87 | + break; |
|
88 | + case 'options': |
|
89 | + $response = $client->options($fullUrl, $options); |
|
90 | + break; |
|
91 | + default: |
|
92 | + throw new \InvalidArgumentException('Invalid method ' . $method); |
|
93 | + } |
|
94 | 94 | |
95 | - return $response->getBody(); |
|
96 | - } |
|
95 | + return $response->getBody(); |
|
96 | + } |
|
97 | 97 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @throws \InvalidArgumentException |
61 | 61 | */ |
62 | 62 | protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { |
63 | - $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url; |
|
63 | + $fullUrl = trim($this->instance->getFullUrl(), '/').'/'.$url; |
|
64 | 64 | $options = [ |
65 | 65 | 'query' => $query, |
66 | 66 | 'headers' => $this->addDefaultHeaders($headers), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $response = $client->options($fullUrl, $options); |
90 | 90 | break; |
91 | 91 | default: |
92 | - throw new \InvalidArgumentException('Invalid method ' . $method); |
|
92 | + throw new \InvalidArgumentException('Invalid method '.$method); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return $response->getBody(); |