@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function offsetGet($offset): mixed |
30 | 30 | { |
31 | - if (isset($this->data[$offset])) { |
|
31 | + if (isset($this->data[$offset])) |
|
32 | + { |
|
32 | 33 | return $this->data[$offset]; |
33 | 34 | } |
34 | 35 | |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | */ |
41 | 42 | public function offsetSet($offset, $value): void |
42 | 43 | { |
43 | - if ($offset === null) { |
|
44 | + if ($offset === null) |
|
45 | + { |
|
44 | 46 | return; |
45 | 47 | } |
46 | 48 | |
@@ -52,7 +54,8 @@ discard block |
||
52 | 54 | */ |
53 | 55 | public function offsetUnset($offset): void |
54 | 56 | { |
55 | - if (isset($this->data[$offset])) { |
|
57 | + if (isset($this->data[$offset])) |
|
58 | + { |
|
56 | 59 | unset($this->data[$offset]); |
57 | 60 | } |
58 | 61 | } |
@@ -21,8 +21,10 @@ discard block |
||
21 | 21 | // build a replacement array with braces around the context keys |
22 | 22 | $replace = []; |
23 | 23 | |
24 | - foreach ($context as $key => $val) { |
|
25 | - if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { |
|
24 | + foreach ($context as $key => $val) |
|
25 | + { |
|
26 | + if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) |
|
27 | + { |
|
26 | 28 | $replace[sprintf('{%s}', $key)] = $val; |
27 | 29 | } |
28 | 30 | } |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | */ |
39 | 41 | public static function canBeCastedToString(mixed $mixed): bool |
40 | 42 | { |
41 | - if (is_string($mixed)) { |
|
43 | + if (is_string($mixed)) |
|
44 | + { |
|
42 | 45 | return true; |
43 | 46 | } |
44 | 47 |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered |
109 | 109 | * the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL |
110 | 110 | */ |
111 | - public function writeln(string|array $messages, $options = 0) |
|
111 | + public function writeln(string | array $messages, $options = 0) |
|
112 | 112 | { |
113 | 113 | $this->output->writeln($messages, $options); |
114 | 114 | } |
@@ -24,17 +24,23 @@ |
||
24 | 24 | { |
25 | 25 | $pageView = $event->getPageView(); |
26 | 26 | |
27 | - if ($pageView instanceof StaticPageView || $pageView instanceof DynamicPageView) { |
|
27 | + if ($pageView instanceof StaticPageView || $pageView instanceof DynamicPageView) |
|
28 | + { |
|
28 | 29 | $redirects = $pageView->getRedirects(); |
29 | 30 | |
30 | - foreach ($redirects as $redirect) { |
|
31 | + foreach ($redirects as $redirect) |
|
32 | + { |
|
31 | 33 | $this->redirectMapper->registerRedirect($redirect, $pageView->getPermalink()); |
32 | 34 | } |
33 | - } elseif ($pageView instanceof RepeaterPageView) { |
|
35 | + } |
|
36 | + elseif ($pageView instanceof RepeaterPageView) |
|
37 | + { |
|
34 | 38 | $permalinks = $pageView->getRepeaterPermalinks(); |
35 | 39 | |
36 | - foreach ($pageView->getRepeaterRedirects() as $repeaterRedirect) { |
|
37 | - foreach ($repeaterRedirect as $index => $redirect) { |
|
40 | + foreach ($pageView->getRepeaterRedirects() as $repeaterRedirect) |
|
41 | + { |
|
42 | + foreach ($repeaterRedirect as $index => $redirect) |
|
43 | + { |
|
38 | 44 | $this->redirectMapper->registerRedirect( |
39 | 45 | $redirect->getEvaluated(), |
40 | 46 | $permalinks[$index]->getEvaluated() |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | $configuration = $event->getConfiguration()->getConfiguration(); |
42 | 42 | |
43 | 43 | /** @var AssetEngineInterface $engine */ |
44 | - foreach ($this->assetEngineManager->getEngines() as $engine) { |
|
44 | + foreach ($this->assetEngineManager->getEngines() as $engine) |
|
45 | + { |
|
45 | 46 | $defaults = __::get($configuration, $engine->getConfigurationNamespace(), []); |
46 | 47 | $options = array_merge($engine->getDefaultConfiguration(), $defaults); |
47 | 48 | |
@@ -55,17 +56,20 @@ discard block |
||
55 | 56 | * @var string $folder |
56 | 57 | * @var AssetEngineInterface $engine |
57 | 58 | */ |
58 | - foreach ($this->assetEngineManager->getFoldersToWatch() as $folder => $engine) { |
|
59 | + foreach ($this->assetEngineManager->getFoldersToWatch() as $folder => $engine) |
|
60 | + { |
|
59 | 61 | $assetFolder = fs::absolutePath($folder); |
60 | 62 | |
61 | - if (!fs::exists($assetFolder)) { |
|
63 | + if (!fs::exists($assetFolder)) |
|
64 | + { |
|
62 | 65 | continue; |
63 | 66 | } |
64 | 67 | |
65 | 68 | $engine->setPageManager($event->getPageManager()); |
66 | 69 | $extensions = []; |
67 | 70 | |
68 | - foreach ($engine->getExtensions() as $extension) { |
|
71 | + foreach ($engine->getExtensions() as $extension) |
|
72 | + { |
|
69 | 73 | $extensions[] = "/.{$extension}.twig$/"; |
70 | 74 | } |
71 | 75 | |
@@ -75,15 +79,19 @@ discard block |
||
75 | 79 | $definition->flags = FileExplorer::INCLUDE_ONLY_FILES | FileExplorer::IGNORE_DIRECTORIES; |
76 | 80 | $explorer = FileExplorer::createFromDefinition($definition); |
77 | 81 | |
78 | - foreach ($explorer as $file) { |
|
82 | + foreach ($explorer as $file) |
|
83 | + { |
|
79 | 84 | $assetPageView = new StaticPageView($file); |
80 | 85 | |
81 | - try { |
|
86 | + try |
|
87 | + { |
|
82 | 88 | $event->getPageManager()->trackNewPageView($assetPageView); |
83 | 89 | $this->assetPageViews[$assetPageView->getRelativeFilePath()] = [ |
84 | 90 | 'engine' => $engine, |
85 | 91 | ]; |
86 | - } catch (Exception $e) { |
|
92 | + } |
|
93 | + catch (Exception $e) |
|
94 | + { |
|
87 | 95 | $this->logger->error('An exception occurred while creating a Static PageView for an AssetEngine'); |
88 | 96 | $this->logger->error(' {message}', [ |
89 | 97 | 'message' => $e->getMessage(), |
@@ -98,12 +106,14 @@ discard block |
||
98 | 106 | $pageView = $event->getPageView(); |
99 | 107 | $filePath = $pageView->getRelativeFilePath(); |
100 | 108 | |
101 | - if (isset($this->assetPageViews[$filePath])) { |
|
109 | + if (isset($this->assetPageViews[$filePath])) |
|
110 | + { |
|
102 | 111 | /** @var AssetEngineInterface $engine */ |
103 | 112 | $engine = $this->assetPageViews[$filePath]['engine']; |
104 | 113 | $cacheDir = $this->buildCacheFolder($engine); |
105 | 114 | |
106 | - if (Service::hasRunTimeFlag(RuntimeStatus::USING_CACHE)) { |
|
115 | + if (Service::hasRunTimeFlag(RuntimeStatus::USING_CACHE)) |
|
116 | + { |
|
107 | 117 | $engine->loadCache($cacheDir); |
108 | 118 | } |
109 | 119 |
@@ -25,12 +25,12 @@ |
||
25 | 25 | |
26 | 26 | private $pageView; |
27 | 27 | |
28 | - public function __construct(BasePageView &$pageView) |
|
28 | + public function __construct(BasePageView & $pageView) |
|
29 | 29 | { |
30 | 30 | $this->pageView = &$pageView; |
31 | 31 | } |
32 | 32 | |
33 | - public function &getPageView(): BasePageView|DynamicPageView|RepeaterPageView|StaticPageView |
|
33 | + public function &getPageView(): BasePageView | DynamicPageView | RepeaterPageView | StaticPageView |
|
34 | 34 | { |
35 | 35 | return $this->pageView; |
36 | 36 | } |
@@ -25,7 +25,8 @@ |
||
25 | 25 | */ |
26 | 26 | public function setCompiledOutput($compiledOutput): void |
27 | 27 | { |
28 | - if (!StrUtils::canBeCastedToString($compiledOutput)) { |
|
28 | + if (!StrUtils::canBeCastedToString($compiledOutput)) |
|
29 | + { |
|
29 | 30 | @trigger_error('CompileProcessPostRenderPageView :: Value cannot be set to something that cannot be cast into a string.', E_USER_WARNING); |
30 | 31 | |
31 | 32 | return; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @return false|self returns false when template is not extending anything |
24 | 24 | */ |
25 | - public function getParentTemplate(): false|self; |
|
25 | + public function getParentTemplate(): false | self; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Render the template with the given context. |
@@ -22,11 +22,13 @@ |
||
22 | 22 | $this->dir = fs::getFolderPath(Service::getOption('currentTemplate')); |
23 | 23 | $this->path = fs::appendPath($this->dir, $location); |
24 | 24 | |
25 | - if (is_file($this->path)) { |
|
25 | + if (is_file($this->path)) |
|
26 | + { |
|
26 | 27 | $this->path = realpath($this->path); |
27 | 28 | } |
28 | 29 | |
29 | - if (!str_starts_with((string)$this->path, (string)Service::getWorkingDirectory())) { |
|
30 | + if (!str_starts_with((string)$this->path, (string)Service::getWorkingDirectory())) |
|
31 | + { |
|
30 | 32 | throw new FileNotFoundException(sprintf( |
31 | 33 | "The '%s' file could not be found or is outside the website working directory", |
32 | 34 | $location |