@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $filters = array_keys($twig->getFilters()); |
281 | 281 | foreach ($filters as $filter) { |
282 | 282 | $docs = self::FILTER_DOCS[$filter] ?? ''; |
283 | - $docs = str_replace('(#', '(' . self::CRAFT_FILTER_DOCS_URL . '#', $docs); |
|
283 | + $docs = str_replace('(#', '('.self::CRAFT_FILTER_DOCS_URL.'#', $docs); |
|
284 | 284 | CompleteItem::create() |
285 | 285 | ->label($filter) |
286 | 286 | ->insertText($filter) |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | // Twig Functions |
293 | 293 | $functions = array_keys($twig->getFunctions()); |
294 | 294 | foreach ($functions as $function) { |
295 | - $functionLabel = $function . '()'; |
|
295 | + $functionLabel = $function.'()'; |
|
296 | 296 | $docs = self::FUNCTION_DOCS[$function] ?? ''; |
297 | - $docs = str_replace('(#', '(' . self::CRAFT_FUNCTION_DOCS_URL . '#', $docs); |
|
297 | + $docs = str_replace('(#', '('.self::CRAFT_FUNCTION_DOCS_URL.'#', $docs); |
|
298 | 298 | CompleteItem::create() |
299 | 299 | ->label($functionLabel) |
300 | 300 | ->insertText($functionLabel) |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $tags = array_merge(self::ADDITIONAL_TAGS, array_keys($twig->getTokenParsers())); |
308 | 308 | foreach ($tags as $tag) { |
309 | 309 | $docs = self::TAG_DOCS[$tag] ?? ''; |
310 | - $docs = str_replace('(#', '(' . self::CRAFT_TAG_DOCS_URL . '#', $docs); |
|
310 | + $docs = str_replace('(#', '('.self::CRAFT_TAG_DOCS_URL.'#', $docs); |
|
311 | 311 | CompleteItem::create() |
312 | 312 | ->label($tag) |
313 | 313 | ->insertText($tag) |
@@ -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 | } |
@@ -120,10 +120,10 @@ |
||
120 | 120 | $value = json_encode(array_keys($value)); |
121 | 121 | } |
122 | 122 | CompleteItem::create() |
123 | - ->detail((string)$value) |
|
123 | + ->detail((string) $value) |
|
124 | 124 | ->kind($kind) |
125 | - ->label((string)$key) |
|
126 | - ->insertText((string)$key) |
|
125 | + ->label((string) $key) |
|
126 | + ->insertText((string) $key) |
|
127 | 127 | ->add($this, $path); |
128 | 128 | break; |
129 | 129 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // Translation category |
102 | 102 | $i18n = Craft::$app->getI18n(); |
103 | 103 | /** @noinspection UnSafeIsSetOverArrayInspection */ |
104 | - if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id . '*'])) { |
|
104 | + if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id.'*'])) { |
|
105 | 105 | $i18n->translations[$this->id] = [ |
106 | 106 | 'class' => PhpMessageSource::class, |
107 | 107 | 'sourceLanguage' => 'en-US', |
@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | public function registerEventHandlers(): void |
136 | 136 | { |
137 | 137 | // Base CP templates directory |
138 | - Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { |
|
139 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
138 | + Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
|
139 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
140 | 140 | $e->roots[$this->id] = $baseDir; |
141 | 141 | } |
142 | 142 | }); |
143 | 143 | // Base Site templates directory |
144 | 144 | if (self::$settings->allowFrontendAccess) { |
145 | - Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) { |
|
146 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
145 | + Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
|
146 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
147 | 147 | $e->roots[$this->id] = $baseDir; |
148 | 148 | } |
149 | 149 | }); |
@@ -88,7 +88,7 @@ |
||
88 | 88 | $path = $item->label; |
89 | 89 | } |
90 | 90 | ArrayHelper::setValue($this->completeItems, $path, [ |
91 | - self::COMPLETION_KEY => array_filter($item->toArray(), static function ($v) { |
|
91 | + self::COMPLETION_KEY => array_filter($item->toArray(), static function($v) { |
|
92 | 92 | return !is_null($v); |
93 | 93 | }) |
94 | 94 | ]); |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $className = $reflectionClass->getName(); |
155 | 155 | $docs = $this->getDocs($reflectionClass, $factory); |
156 | 156 | CompleteItem::create() |
157 | - ->detail((string)$className) |
|
158 | - ->documentation((string)$docs) |
|
157 | + ->detail((string) $className) |
|
158 | + ->documentation((string) $docs) |
|
159 | 159 | ->kind(CompleteItemKind::ClassKind) |
160 | - ->label((string)$name) |
|
161 | - ->insertText((string)$name) |
|
160 | + ->label((string) $name) |
|
161 | + ->insertText((string) $name) |
|
162 | 162 | ->add($this, $path); |
163 | 163 | } |
164 | 164 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Exclude some properties |
209 | 209 | $propertyAllowed = true; |
210 | 210 | foreach (self::EXCLUDED_PROPERTY_REGEXES as $excludePattern) { |
211 | - $pattern = '`' . $excludePattern . '`i'; |
|
211 | + $pattern = '`'.$excludePattern.'`i'; |
|
212 | 212 | if (preg_match($pattern, $propertyName) === 1) { |
213 | 213 | $propertyAllowed = false; |
214 | 214 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $value = json_encode($value); |
263 | 263 | } |
264 | 264 | if (!empty($value)) { |
265 | - $detail = (string)$value; |
|
265 | + $detail = (string) $value; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | $thisPath = trim(implode('.', [$path, $propertyName]), '.'); |
271 | 271 | $label = $propertyName; |
272 | 272 | CompleteItem::create() |
273 | - ->detail((string)$detail) |
|
274 | - ->documentation((string)$docs) |
|
273 | + ->detail((string) $detail) |
|
274 | + ->documentation((string) $docs) |
|
275 | 275 | ->kind($customField ? CompleteItemKind::FieldKind : CompleteItemKind::PropertyKind) |
276 | - ->label((string)$label) |
|
277 | - ->insertText((string)$label) |
|
278 | - ->sortText((string)$sortPrefix . (string)$label) |
|
276 | + ->label((string) $label) |
|
277 | + ->insertText((string) $label) |
|
278 | + ->sortText((string) $sortPrefix.(string) $label) |
|
279 | 279 | ->add($this, $thisPath); |
280 | 280 | // Recurse through if this is an object |
281 | 281 | if (isset($object->$propertyName) && is_object($object->$propertyName)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // Exclude some properties |
306 | 306 | $methodAllowed = true; |
307 | 307 | foreach (self::EXCLUDED_METHOD_REGEXES as $excludePattern) { |
308 | - $pattern = '`' . $excludePattern . '`i'; |
|
308 | + $pattern = '`'.$excludePattern.'`i'; |
|
309 | 309 | if (preg_match($pattern, $methodName) === 1) { |
310 | 310 | $methodAllowed = false; |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($methodAllowed && $reflectionMethod->isPublic()) { |
315 | 315 | $docblock = null; |
316 | 316 | $docs = $this->getDocs($reflectionMethod, $factory); |
317 | - $detail = $methodName . '('; |
|
317 | + $detail = $methodName.'('; |
|
318 | 318 | $params = $reflectionMethod->getParameters(); |
319 | 319 | $paramList = []; |
320 | 320 | foreach ($params as $param) { |
@@ -324,20 +324,20 @@ discard block |
||
324 | 324 | $unionTypes = $reflectionType->getTypes(); |
325 | 325 | $typeName = ''; |
326 | 326 | foreach ($unionTypes as $unionType) { |
327 | - $typeName .= '|' . $unionType->getName(); |
|
327 | + $typeName .= '|'.$unionType->getName(); |
|
328 | 328 | } |
329 | 329 | $typeName = trim($typeName, '|'); |
330 | - $paramList[] = $typeName . ': ' . '$' . $param->getName(); |
|
330 | + $paramList[] = $typeName.': '.'$'.$param->getName(); |
|
331 | 331 | } else { |
332 | - $paramList[] = $param->getType()->getName() . ': ' . '$' . $param->getName(); |
|
332 | + $paramList[] = $param->getType()->getName().': '.'$'.$param->getName(); |
|
333 | 333 | } |
334 | 334 | } else { |
335 | - $paramList[] = '$' . $param->getName(); |
|
335 | + $paramList[] = '$'.$param->getName(); |
|
336 | 336 | } |
337 | 337 | } |
338 | - $detail .= implode(', ', $paramList) . ')'; |
|
338 | + $detail .= implode(', ', $paramList).')'; |
|
339 | 339 | $thisPath = trim(implode('.', [$path, $methodName]), '.'); |
340 | - $label = $methodName . '()'; |
|
340 | + $label = $methodName.'()'; |
|
341 | 341 | $docsPreamble = ''; |
342 | 342 | // Figure out the type |
343 | 343 | if ($docblock) { |
@@ -345,18 +345,18 @@ discard block |
||
345 | 345 | if ($tags) { |
346 | 346 | $docsPreamble = "Parameters:\n\n"; |
347 | 347 | foreach ($tags as $tag) { |
348 | - $docsPreamble .= $tag . "\n"; |
|
348 | + $docsPreamble .= $tag."\n"; |
|
349 | 349 | } |
350 | 350 | $docsPreamble .= "\n"; |
351 | 351 | } |
352 | 352 | } |
353 | 353 | CompleteItem::create() |
354 | - ->detail((string)$detail) |
|
355 | - ->documentation((string)$docsPreamble . (string)$docs) |
|
354 | + ->detail((string) $detail) |
|
355 | + ->documentation((string) $docsPreamble.(string) $docs) |
|
356 | 356 | ->kind(CompleteItemKind::MethodKind) |
357 | - ->label((string)$label) |
|
358 | - ->insertText((string)$label) |
|
359 | - ->sortText($this->methodSortPrefix . (string)$label) |
|
357 | + ->label((string) $label) |
|
358 | + ->insertText((string) $label) |
|
359 | + ->sortText($this->methodSortPrefix.(string) $label) |
|
360 | 360 | ->add($this, $thisPath); |
361 | 361 | } |
362 | 362 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->cacheDuration = 1; |
99 | 99 | } |
100 | 100 | // Invalidate any SectionShorthandFieldsAutocomplete caches whenever any field layout is edited |
101 | - Event::on(Fields::class, Fields::EVENT_AFTER_SAVE_FIELD_LAYOUT, function (SectionEvent $e) { |
|
101 | + Event::on(Fields::class, Fields::EVENT_AFTER_SAVE_FIELD_LAYOUT, function(SectionEvent $e) { |
|
102 | 102 | $this->clearAutocompleteCache(SectionShorthandFieldsAutocomplete::class); |
103 | 103 | }); |
104 | 104 | } |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | $dependency = new TagDependency([ |
137 | 137 | 'tags' => [ |
138 | 138 | self::AUTOCOMPLETE_CACHE_TAG, |
139 | - self::AUTOCOMPLETE_CACHE_TAG . $name, |
|
140 | - self::AUTOCOMPLETE_CACHE_TAG . get_class($autocomplete), |
|
139 | + self::AUTOCOMPLETE_CACHE_TAG.$name, |
|
140 | + self::AUTOCOMPLETE_CACHE_TAG.get_class($autocomplete), |
|
141 | 141 | ], |
142 | 142 | ]); |
143 | 143 | // Get the autocompletes from the cache, or generate them if they aren't cached |
144 | - $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function () use ($name, $autocomplete) { |
|
144 | + $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function() use ($name, $autocomplete) { |
|
145 | 145 | $autocomplete->generateCompleteItems(); |
146 | 146 | return [ |
147 | 147 | 'name' => $name, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function clearAutocompleteCache(string $autocompleteName = ''): void |
166 | 166 | { |
167 | 167 | $cache = Craft::$app->getCache(); |
168 | - TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG . $autocompleteName); |
|
168 | + TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG.$autocompleteName); |
|
169 | 169 | Craft::info('CodeEditor caches invalidated', __METHOD__); |
170 | 170 | } |
171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getAutocompleteCacheKey(AutocompleteInterface $autocomplete, array $config): string |
180 | 180 | { |
181 | - return $this->cacheKeyPrefix . $autocomplete->name . md5(serialize($config)); |
|
181 | + return $this->cacheKeyPrefix.$autocomplete->name.md5(serialize($config)); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // Protected Methods |
@@ -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/codeeditor/config.php', false); |