@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $filters = array_keys($twig->getFilters()); |
249 | 249 | foreach ($filters as $filter) { |
250 | 250 | $docs = self::FILTER_DOCS[$filter] ?? ''; |
251 | - $docs = str_replace('(#', '(' . self::CRAFT_FILTER_DOCS_URL . '#', $docs); |
|
251 | + $docs = str_replace('(#', '('.self::CRAFT_FILTER_DOCS_URL.'#', $docs); |
|
252 | 252 | CompleteItem::create() |
253 | 253 | ->label($filter) |
254 | 254 | ->insertText($filter) |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | // Twig Functions |
261 | 261 | $functions = array_keys($twig->getFunctions()); |
262 | 262 | foreach ($functions as $function) { |
263 | - $functionLabel = $function . '()'; |
|
263 | + $functionLabel = $function.'()'; |
|
264 | 264 | $docs = self::FUNCTION_DOCS[$function] ?? ''; |
265 | - $docs = str_replace('(#', '(' . self::CRAFT_FUNCTION_DOCS_URL . '#', $docs); |
|
265 | + $docs = str_replace('(#', '('.self::CRAFT_FUNCTION_DOCS_URL.'#', $docs); |
|
266 | 266 | CompleteItem::create() |
267 | 267 | ->label($functionLabel) |
268 | 268 | ->insertText($functionLabel) |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $tags = array_keys($twig->getTokenParsers()); |
276 | 276 | foreach ($tags as $tag) { |
277 | 277 | $docs = self::TAG_DOCS[$tag] ?? ''; |
278 | - $docs = str_replace('(#', '(' . self::CRAFT_TAG_DOCS_URL . '#', $docs); |
|
278 | + $docs = str_replace('(#', '('.self::CRAFT_TAG_DOCS_URL.'#', $docs); |
|
279 | 279 | CompleteItem::create() |
280 | 280 | ->label($tag) |
281 | 281 | ->insertText($tag) |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | // Exclude some properties |
237 | 237 | $propertyAllowed = true; |
238 | 238 | foreach (self::EXCLUDED_PROPERTY_REGEXES as $excludePattern) { |
239 | - $pattern = '`' . $excludePattern . '`i'; |
|
239 | + $pattern = '`'.$excludePattern.'`i'; |
|
240 | 240 | if (preg_match($pattern, $propertyName) === 1) { |
241 | 241 | $propertyAllowed = false; |
242 | 242 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 'kind' => $customField ? CompleteItemKind::FieldKind : CompleteItemKind::PropertyKind, |
312 | 312 | 'label' => $label, |
313 | 313 | 'insertText' => $label, |
314 | - 'sortText' => $sortPrefix . $label, |
|
314 | + 'sortText' => $sortPrefix.$label, |
|
315 | 315 | ]), $thisPath); |
316 | 316 | // Recurse through if this is an object |
317 | 317 | if (isset($object->$propertyName) && is_object($object->$propertyName)) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | // Exclude some properties |
342 | 342 | $methodAllowed = true; |
343 | 343 | foreach (self::EXCLUDED_METHOD_REGEXES as $excludePattern) { |
344 | - $pattern = '`' . $excludePattern . '`i'; |
|
344 | + $pattern = '`'.$excludePattern.'`i'; |
|
345 | 345 | if (preg_match($pattern, $methodName) === 1) { |
346 | 346 | $methodAllowed = false; |
347 | 347 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |
366 | - $detail = $methodName . '('; |
|
366 | + $detail = $methodName.'('; |
|
367 | 367 | $params = $reflectionMethod->getParameters(); |
368 | 368 | $paramList = []; |
369 | 369 | foreach ($params as $param) { |
@@ -373,20 +373,20 @@ discard block |
||
373 | 373 | $unionTypes = $reflectionType->getTypes(); |
374 | 374 | $typeName = ''; |
375 | 375 | foreach ($unionTypes as $unionType) { |
376 | - $typeName .= '|' . $unionType->getName(); |
|
376 | + $typeName .= '|'.$unionType->getName(); |
|
377 | 377 | } |
378 | 378 | $typeName = trim($typeName, '|'); |
379 | - $paramList[] = $typeName . ': ' . '$' . $param->getName(); |
|
379 | + $paramList[] = $typeName.': '.'$'.$param->getName(); |
|
380 | 380 | } else { |
381 | - $paramList[] = $param->getType()->getName() . ': ' . '$' . $param->getName(); |
|
381 | + $paramList[] = $param->getType()->getName().': '.'$'.$param->getName(); |
|
382 | 382 | } |
383 | 383 | } else { |
384 | - $paramList[] = '$' . $param->getName(); |
|
384 | + $paramList[] = '$'.$param->getName(); |
|
385 | 385 | } |
386 | 386 | } |
387 | - $detail .= implode(', ', $paramList) . ')'; |
|
387 | + $detail .= implode(', ', $paramList).')'; |
|
388 | 388 | $thisPath = trim(implode('.', [$path, $methodName]), '.'); |
389 | - $label = $methodName . '()'; |
|
389 | + $label = $methodName.'()'; |
|
390 | 390 | $docsPreamble = ''; |
391 | 391 | // Figure out the type |
392 | 392 | if ($docblock) { |
@@ -394,18 +394,18 @@ discard block |
||
394 | 394 | if ($tags) { |
395 | 395 | $docsPreamble = "Parameters:\n\n"; |
396 | 396 | foreach ($tags as $tag) { |
397 | - $docsPreamble .= $tag . "\n"; |
|
397 | + $docsPreamble .= $tag."\n"; |
|
398 | 398 | } |
399 | 399 | $docsPreamble .= "\n"; |
400 | 400 | } |
401 | 401 | } |
402 | 402 | $this->addCompleteItem(new CompleteItem([ |
403 | 403 | 'detail' => $detail, |
404 | - 'documentation' => $docsPreamble . $docs, |
|
404 | + 'documentation' => $docsPreamble.$docs, |
|
405 | 405 | 'kind' => CompleteItemKind::MethodKind, |
406 | 406 | 'label' => $label, |
407 | 407 | 'insertText' => $label, |
408 | - 'sortText' => '~~~' . $label, |
|
408 | + 'sortText' => '~~~'.$label, |
|
409 | 409 | ]), $thisPath); |
410 | 410 | } |
411 | 411 | } |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | $name = $autocomplete->name; |
112 | 112 | // Set up the cache parameters |
113 | 113 | $cache = Craft::$app->getCache(); |
114 | - $cacheKey = $this->cacheKeyPrefix . $name; |
|
114 | + $cacheKey = $this->cacheKeyPrefix.$name; |
|
115 | 115 | $dependency = new TagDependency([ |
116 | 116 | 'tags' => [ |
117 | 117 | self::AUTOCOMPLETE_CACHE_TAG, |
118 | - self::AUTOCOMPLETE_CACHE_TAG . $name, |
|
118 | + self::AUTOCOMPLETE_CACHE_TAG.$name, |
|
119 | 119 | ], |
120 | 120 | ]); |
121 | 121 | // Get the autocompletes from the cache, or generate them if they aren't cached |
122 | - $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function () use ($name, $autocomplete) { |
|
122 | + $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function() use ($name, $autocomplete) { |
|
123 | 123 | $autocomplete->generateCompleteItems(); |
124 | 124 | return [ |
125 | 125 | 'name' => $name, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function clearAutocompleteCache(string $autocompleteName = ''): void |
143 | 143 | { |
144 | 144 | $cache = Craft::$app->getCache(); |
145 | - TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG . $autocompleteName); |
|
145 | + TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG.$autocompleteName); |
|
146 | 146 | Craft::info('Twigfield caches invalidated', __METHOD__); |
147 | 147 | } |
148 | 148 |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // Translation category |
103 | 103 | $i18n = Craft::$app->getI18n(); |
104 | 104 | /** @noinspection UnSafeIsSetOverArrayInspection */ |
105 | - if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id . '*'])) { |
|
105 | + if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id.'*'])) { |
|
106 | 106 | $i18n->translations[$this->id] = [ |
107 | 107 | 'class' => PhpMessageSource::class, |
108 | 108 | 'sourceLanguage' => 'en-US', |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | public function registerEventHandlers(): void |
137 | 137 | { |
138 | 138 | // Base CP templates directory |
139 | - Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { |
|
140 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
139 | + Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
|
140 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
141 | 141 | $e->roots[$this->id] = $baseDir; |
142 | 142 | } |
143 | 143 | }); |
144 | 144 | // Base Site templates directory |
145 | 145 | if (self::$settings->allowFrontendAccess) { |
146 | - Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { |
|
147 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
146 | + Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
|
147 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
148 | 148 | $e->roots[$this->id] = $baseDir; |
149 | 149 | } |
150 | 150 | }); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $fileName .= self::PHP_SUFFIX; |
42 | 42 | $currentEnv = Craft::$app->getConfig()->env; |
43 | 43 | // Try craft/config first |
44 | - $path = Craft::getAlias('@config/' . $fileName, false); |
|
44 | + $path = Craft::getAlias('@config/'.$fileName, false); |
|
45 | 45 | if ($path === false || !file_exists($path)) { |
46 | 46 | // Now try our own internal config |
47 | 47 | $path = Craft::getAlias('@nystudio107/twigfield/config.php', false); |
@@ -71,7 +71,7 @@ |
||
71 | 71 | $path = $item->label; |
72 | 72 | } |
73 | 73 | ArrayHelper::setValue($this->completeItems, $path, [ |
74 | - self::COMPLETION_KEY => array_filter($item->toArray(), static function ($v) { |
|
74 | + self::COMPLETION_KEY => array_filter($item->toArray(), static function($v) { |
|
75 | 75 | return !is_null($v); |
76 | 76 | }) |
77 | 77 | ]); |
@@ -62,7 +62,7 @@ |
||
62 | 62 | ->filterText($trimmedName) |
63 | 63 | ->detail($item['hint']) |
64 | 64 | ->kind(CompleteItemKind::ConstantKind) |
65 | - ->sortText('~' . $name) |
|
65 | + ->sortText('~'.$name) |
|
66 | 66 | ->add($this); |
67 | 67 | } |
68 | 68 | } |