@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | $id = $file->getId(); |
| 72 | 72 | $currentFilePath = $this->root->getFullPath($file->getPath()); |
| 73 | 73 | $currentBasePath = pathinfo($currentFilePath, PATHINFO_DIRNAME); |
| 74 | - $fileSuffix = '.' . pathinfo($file->getName(), PATHINFO_EXTENSION); |
|
| 74 | + $fileSuffix = '.'.pathinfo($file->getName(), PATHINFO_EXTENSION); |
|
| 75 | 75 | |
| 76 | 76 | // detect (new) folder path based on category name |
| 77 | - if ($category===null) { |
|
| 77 | + if ($category === null) { |
|
| 78 | 78 | $basePath = $currentBasePath; |
| 79 | 79 | } else { |
| 80 | 80 | $basePath = $notesFolder->getPath(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | // sanitise path |
| 83 | 83 | $cats = explode('/', $category); |
| 84 | 84 | $cats = array_map([$this, 'sanitisePath'], $cats); |
| 85 | - $cats = array_filter($cats, function ($str) { |
|
| 85 | + $cats = array_filter($cats, function($str) { |
|
| 86 | 86 | return !empty($str); |
| 87 | 87 | }); |
| 88 | 88 | $basePath .= '/'.implode('/', $cats); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $folder = $this->getOrCreateFolder($basePath); |
| 92 | 92 | |
| 93 | 93 | // assemble new file path |
| 94 | - $newFilePath = $basePath . '/' . $this->generateFileName($folder, $title, $fileSuffix, $id); |
|
| 94 | + $newFilePath = $basePath.'/'.$this->generateFileName($folder, $title, $fileSuffix, $id); |
|
| 95 | 95 | |
| 96 | 96 | // if the current path is not the new path, the file has to be renamed |
| 97 | 97 | if ($currentFilePath !== $newFilePath) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * files with the same title |
| 120 | 120 | */ |
| 121 | 121 | public function generateFileName(Folder $folder, string $title, string $suffix, int $id) : string { |
| 122 | - $path = $title . $suffix; |
|
| 122 | + $path = $title.$suffix; |
|
| 123 | 123 | |
| 124 | 124 | // if file does not exist, that name has not been taken. Similar we don't |
| 125 | 125 | // need to handle file collisions if it is the filename did not change |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | $newId = ((int) $matches['id']) + 1; |
| 133 | 133 | $newTitle = preg_replace( |
| 134 | 134 | '/(.*)\s\((\d+)\)$/u', |
| 135 | - '$1 (' . $newId . ')', |
|
| 135 | + '$1 ('.$newId.')', |
|
| 136 | 136 | $title |
| 137 | 137 | ); |
| 138 | 138 | } else { |
| 139 | - $newTitle = $title . ' (2)'; |
|
| 139 | + $newTitle = $title.' (2)'; |
|
| 140 | 140 | } |
| 141 | 141 | return $this->generateFileName($folder, $newTitle, $suffix, $id); |
| 142 | 142 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | public function deleteEmptyFolder(Folder $notesFolder, Folder $folder) : void { |
| 215 | 215 | $content = $folder->getDirectoryListing(); |
| 216 | 216 | $isEmpty = !count($content); |
| 217 | - $isNotesFolder = $folder->getPath()===$notesFolder->getPath(); |
|
| 217 | + $isNotesFolder = $folder->getPath() === $notesFolder->getPath(); |
|
| 218 | 218 | if ($isEmpty && !$isNotesFolder) { |
| 219 | 219 | $this->logger->info('Deleting empty category folder '.$folder->getPath(), ['app' => $this->appName]); |
| 220 | 220 | $parent = $folder->getParent(); |