@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | use OCA\Files_Trashbin\Capabilities; |
34 | 34 | |
35 | 35 | class Application extends App { |
36 | - public function __construct (array $urlParams = []) { |
|
36 | + public function __construct(array $urlParams = []) { |
|
37 | 37 | parent::__construct('files_trashbin', $urlParams); |
38 | 38 | |
39 | 39 | $container = $this->getContainer(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /* |
56 | 56 | * Register $principalBackend for the DAV collection |
57 | 57 | */ |
58 | - $container->registerService('principalBackend', function () { |
|
58 | + $container->registerService('principalBackend', function() { |
|
59 | 59 | return new Principal( |
60 | 60 | \OC::$server->getUserManager(), |
61 | 61 | \OC::$server->getGroupManager(), |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | $appManager = $server->getAppManager(); |
79 | 79 | /** @var ITrashManager $trashManager */ |
80 | 80 | $trashManager = $this->getContainer()->getServer()->query(ITrashManager::class); |
81 | - foreach($appManager->getInstalledApps() as $app) { |
|
81 | + foreach ($appManager->getInstalledApps() as $app) { |
|
82 | 82 | $appInfo = $appManager->getAppInfo($app); |
83 | 83 | if (isset($appInfo['trash'])) { |
84 | 84 | $backends = $appInfo['trash']; |
85 | - foreach($backends as $backend) { |
|
85 | + foreach ($backends as $backend) { |
|
86 | 86 | $class = $backend['@value']; |
87 | 87 | $for = $backend['@attributes']['for']; |
88 | 88 |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array { |
53 | 53 | $parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : ''; |
54 | 54 | $isRoot = $parent === null; |
55 | - return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
55 | + return array_map(function(FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) { |
|
56 | 56 | return new TrashItem( |
57 | 57 | $this, |
58 | - $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(), |
|
58 | + $isRoot ? $file['extraData'] : $parent->getOriginalLocation().'/'.$file->getName(), |
|
59 | 59 | $file->getMTime(), |
60 | - $parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''), |
|
60 | + $parentTrashPath.'/'.$file->getName().($isRoot ? '.d'.$file->getMtime() : ''), |
|
61 | 61 | $file, |
62 | 62 | $user |
63 | 63 | ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function listTrashFolder(ITrashItem $folder): array { |
73 | 73 | $user = $folder->getUser(); |
74 | 74 | $entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID()); |
75 | - return $this->mapTrashItems($entries, $user ,$folder); |
|
75 | + return $this->mapTrashItems($entries, $user, $folder); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | public function restoreItem(ITrashItem $item) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function removeItem(ITrashItem $item) { |
83 | 83 | $user = $item->getUser(); |
84 | 84 | if ($item->isRootItem()) { |
85 | - $path = substr($item->getTrashPath(), 0, -strlen('.d' . $item->getDeletedTime())); |
|
85 | + $path = substr($item->getTrashPath(), 0, -strlen('.d'.$item->getDeletedTime())); |
|
86 | 86 | Trashbin::delete($path, $user->getUID(), $item->getDeletedTime()); |
87 | 87 | } else { |
88 | 88 | Trashbin::delete($item->getTrashPath(), $user->getUID(), null); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (!$storage instanceof Storage) { |
95 | 95 | return false; |
96 | 96 | } |
97 | - $normalized = Filesystem::normalizePath($storage->getMountPoint() . '/' . $internalPath, true, false, true); |
|
97 | + $normalized = Filesystem::normalizePath($storage->getMountPoint().'/'.$internalPath, true, false, true); |
|
98 | 98 | $view = Filesystem::getView(); |
99 | 99 | if (!isset($this->deletedFiles[$normalized]) && $view instanceof View) { |
100 | 100 | $this->deletedFiles[$normalized] = $normalized; |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | public function listTrashRoot(IUser $user): array { |
47 | - $items = array_reduce($this->getBackends(), function (array $items, ITrashBackend $backend) use ($user) { |
|
47 | + $items = array_reduce($this->getBackends(), function(array $items, ITrashBackend $backend) use ($user) { |
|
48 | 48 | return array_merge($items, $backend->listTrashRoot($user)); |
49 | 49 | }, []); |
50 | - usort($items, function (ITrashItem $a, ITrashItem $b) { |
|
50 | + usort($items, function(ITrashItem $a, ITrashItem $b) { |
|
51 | 51 | return $a->getDeletedTime() - $b->getDeletedTime(); |
52 | 52 | }); |
53 | 53 | return $items; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getBackendForStorage(IStorage $storage): ITrashBackend { |
78 | 78 | $fullType = get_class($storage); |
79 | - $foundType = array_reduce(array_keys($this->backends), function ($type, $registeredType) use ($storage) { |
|
79 | + $foundType = array_reduce(array_keys($this->backends), function($type, $registeredType) use ($storage) { |
|
80 | 80 | if ( |
81 | 81 | $storage->instanceOfStorage($registeredType) && |
82 | 82 | ($type === '' || is_subclass_of($registeredType, $type)) |
@@ -26,6 +26,6 @@ |
||
26 | 26 | |
27 | 27 | class TrashFolder extends AbstractTrashFolder { |
28 | 28 | public function getName(): string { |
29 | - return $this->data->getName() . '.d' . $this->getLastModified(); |
|
29 | + return $this->data->getName().'.d'.$this->getLastModified(); |
|
30 | 30 | } |
31 | 31 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | use Sabre\DAV\Exception\Forbidden; |
26 | 26 | use Sabre\DAV\IFile; |
27 | 27 | |
28 | -abstract class AbstractTrashFile extends AbstractTrash implements IFile , ITrash{ |
|
28 | +abstract class AbstractTrashFile extends AbstractTrash implements IFile, ITrash{ |
|
29 | 29 | public function put($data) { |
30 | 30 | throw new Forbidden(); |
31 | 31 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public function getChildren(): array { |
68 | 68 | $entries = $this->trashManager->listTrashRoot($this->user); |
69 | 69 | |
70 | - $children = array_map(function (ITrashItem $entry) { |
|
70 | + $children = array_map(function(ITrashItem $entry) { |
|
71 | 71 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
72 | 72 | return new TrashFolder($this->trashManager, $entry); |
73 | 73 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function getChildren(): array { |
33 | 33 | $entries = $this->trashManager->listTrashFolder($this->data); |
34 | 34 | |
35 | - $children = array_map(function (ITrashItem $entry) { |
|
35 | + $children = array_map(function(ITrashItem $entry) { |
|
36 | 36 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
37 | 37 | return new TrashFolderFolder($this->trashManager, $entry); |
38 | 38 | } |
@@ -26,10 +26,10 @@ |
||
26 | 26 | |
27 | 27 | class TrashFile extends AbstractTrashFile { |
28 | 28 | public function get() { |
29 | - return $this->data->getStorage()->fopen($this->data->getInternalPath() . '.d' . $this->getLastModified(), 'rb'); |
|
29 | + return $this->data->getStorage()->fopen($this->data->getInternalPath().'.d'.$this->getLastModified(), 'rb'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function getName(): string { |
33 | - return $this->data->getName() . '.d' . $this->getLastModified(); |
|
33 | + return $this->data->getName().'.d'.$this->getLastModified(); |
|
34 | 34 | } |
35 | 35 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } catch (GenericEncryptionException $e) { |
100 | 100 | // in case of a encryption exception we delete the file right away |
101 | 101 | $this->logger->info( |
102 | - "Can't move file" . $path . |
|
102 | + "Can't move file".$path. |
|
103 | 103 | "to the trash bin, therefore it was deleted right away"); |
104 | 104 | |
105 | 105 | return $this->storage->unlink($path); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); |
|
140 | + $normalized = Filesystem::normalizePath($this->mountPoint.'/'.$path); |
|
141 | 141 | $parts = explode('/', $normalized); |
142 | 142 | if (count($parts) < 4) { |
143 | 143 | return false; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * Setup the storate wrapper callback |
196 | 196 | */ |
197 | 197 | public static function setupStorage() { |
198 | - \OC\Files\Filesystem::addStorageWrapper('oc_trashbin', function ($mountPoint, $storage) { |
|
198 | + \OC\Files\Filesystem::addStorageWrapper('oc_trashbin', function($mountPoint, $storage) { |
|
199 | 199 | return new \OCA\Files_Trashbin\Storage( |
200 | 200 | ['storage' => $storage, 'mountPoint' => $mountPoint], |
201 | 201 | \OC::$server->query(ITrashManager::class), |