@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | |
113 | 113 | public function listCreators(): array { |
114 | 114 | $types = $this->getTypes(); |
115 | - usort($types, function (TemplateFileCreator $a, TemplateFileCreator $b) { |
|
115 | + usort($types, function(TemplateFileCreator $a, TemplateFileCreator $b) { |
|
116 | 116 | return $a->getOrder() - $b->getOrder(); |
117 | 117 | }); |
118 | 118 | return $types; |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function listTemplates(): array { |
122 | - return array_values(array_map(function (TemplateFileCreator $entry) { |
|
122 | + return array_values(array_map(function(TemplateFileCreator $entry) { |
|
123 | 123 | return array_merge($entry->jsonSerialize(), [ |
124 | 124 | 'templates' => $this->getTemplateFiles($entry) |
125 | 125 | ]); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if ($templateType === 'user' && $templateId !== '') { |
163 | 163 | $template = $userFolder->get($templateId); |
164 | 164 | } else { |
165 | - $matchingProvider = array_filter($this->getRegisteredProviders(), function (ICustomTemplateProvider $provider) use ($templateType) { |
|
165 | + $matchingProvider = array_filter($this->getRegisteredProviders(), function(ICustomTemplateProvider $provider) use ($templateType) { |
|
166 | 166 | return $templateType === get_class($provider); |
167 | 167 | }); |
168 | 168 | $provider = array_shift($matchingProvider); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | $matchedTemplates = array_filter( |
265 | 265 | array_merge($providerTemplates, $userTemplates), |
266 | - function (Template $template) use ($fileId) { |
|
266 | + function(Template $template) use ($fileId) { |
|
267 | 267 | return $template->jsonSerialize()['fileid'] === $fileId; |
268 | 268 | }); |
269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | |
274 | 274 | $this->eventDispatcher->dispatchTyped(new BeforeGetTemplatesEvent($matchedTemplates, true)); |
275 | 275 | |
276 | - return array_values(array_map(function (Template $template) { |
|
276 | + return array_values(array_map(function(Template $template) { |
|
277 | 277 | return $template->jsonSerialize()['fields'] ?? []; |
278 | 278 | }, $matchedTemplates)); |
279 | 279 | } |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | $this->userId = $userId; |
322 | 322 | } |
323 | 323 | |
324 | - $defaultSkeletonDirectory = \OC::$SERVERROOT . '/core/skeleton'; |
|
325 | - $defaultTemplateDirectory = \OC::$SERVERROOT . '/core/skeleton/Templates'; |
|
324 | + $defaultSkeletonDirectory = \OC::$SERVERROOT.'/core/skeleton'; |
|
325 | + $defaultTemplateDirectory = \OC::$SERVERROOT.'/core/skeleton/Templates'; |
|
326 | 326 | $skeletonPath = $this->config->getSystemValueString('skeletondirectory', $defaultSkeletonDirectory); |
327 | 327 | $skeletonTemplatePath = $this->config->getSystemValueString('templatedirectory', $defaultTemplateDirectory); |
328 | 328 | $isDefaultSkeleton = $skeletonPath === $defaultSkeletonDirectory; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | try { |
338 | 338 | $l10n = $this->l10nFactory->get('lib', $userLang); |
339 | 339 | $userFolder = $this->rootFolder->getUserFolder($this->userId); |
340 | - $userTemplatePath = $path ?? $this->config->getAppValue('core', 'defaultTemplateDirectory', $l10n->t('Templates')) . '/'; |
|
340 | + $userTemplatePath = $path ?? $this->config->getAppValue('core', 'defaultTemplateDirectory', $l10n->t('Templates')).'/'; |
|
341 | 341 | |
342 | 342 | // Initial user setup without a provided path |
343 | 343 | if ($path === null) { |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | if (!$userFolder->nodeExists('Templates')) { |
347 | 347 | return ''; |
348 | 348 | } |
349 | - $newPath = Filesystem::normalizePath($userFolder->getPath() . '/' . $userTemplatePath); |
|
349 | + $newPath = Filesystem::normalizePath($userFolder->getPath().'/'.$userTemplatePath); |
|
350 | 350 | if ($newPath !== $userFolder->get('Templates')->getPath()) { |
351 | 351 | $userFolder->get('Templates')->move($newPath); |
352 | 352 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($path !== null && $isDefaultSkeleton && $isDefaultTemplates && $folderIsEmpty) { |
388 | - $localizedSkeletonPath = $this->getLocalizedTemplatePath($skeletonPath . '/Templates', $userLang); |
|
388 | + $localizedSkeletonPath = $this->getLocalizedTemplatePath($skeletonPath.'/Templates', $userLang); |
|
389 | 389 | if (!empty($localizedSkeletonPath) && file_exists($localizedSkeletonPath)) { |
390 | 390 | \OC_Util::copyr($localizedSkeletonPath, $folder); |
391 | 391 | $userFolder->getStorage()->getScanner()->scan($folder->getInternalPath(), Scanner::SCAN_RECURSIVE); |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $this->setTemplatePath($path ?? ''); |
398 | 398 | return $this->getTemplatePath(); |
399 | 399 | } catch (\Throwable $e) { |
400 | - $this->logger->error('Failed to initialize templates directory to user language ' . $userLang . ' for ' . $userId, ['app' => 'files_templates', 'exception' => $e]); |
|
400 | + $this->logger->error('Failed to initialize templates directory to user language '.$userLang.' for '.$userId, ['app' => 'files_templates', 'exception' => $e]); |
|
401 | 401 | } |
402 | 402 | $this->setTemplatePath(''); |
403 | 403 | return $this->getTemplatePath(); |