@@ -58,7 +58,7 @@ |
||
58 | 58 | * |
59 | 59 | * @param string $className The class name of the section model. |
60 | 60 | * @throws InvalidArgumentException If the class name is not a string. |
61 | - * @return AbstractPropertyDisplay Chainable |
|
61 | + * @return ContextualTemplateTrait Chainable |
|
62 | 62 | */ |
63 | 63 | public function setGenericContextClass($className) |
64 | 64 | { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * Note: The application's locale is already modified and will be reset |
169 | 169 | * after processing all available languages. |
170 | 170 | * |
171 | - * @param mixed $context The translated {@see \Charcoal\Model\ModelInterface model} |
|
171 | + * @param \Charcoal\Model\ModelInterface|null $context The translated {@see \Charcoal\Model\ModelInterface model} |
|
172 | 172 | * or array-accessible structure. |
173 | 173 | * @param array $localeStruct The currently iterated language. |
174 | 174 | * @return array Returns a link structure. |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | /** |
214 | 214 | * Yield the alternate translations associated with the current route. |
215 | 215 | * |
216 | - * @return Generator|null |
|
216 | + * @return \Generator |
|
217 | 217 | */ |
218 | 218 | public function alternateTranslations() |
219 | 219 | { |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | protected function formatAlternateTranslation($context, array $localeStruct) |
177 | 177 | { |
178 | 178 | return [ |
179 | - 'id' => ($context['id']) ? : $this->templateName(), |
|
180 | - 'title' => ((string)$context['title']) ? : $this->title(), |
|
179 | + 'id' => ($context['id']) ?: $this->templateName(), |
|
180 | + 'title' => ((string) $context['title']) ?: $this->title(), |
|
181 | 181 | 'url' => $this->formatAlternateTranslationUrl($context, $localeStruct), |
182 | 182 | 'hreflang' => $localeStruct['code'], |
183 | 183 | 'locale' => $localeStruct['locale'], |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $isRoutable = ($context instanceof RoutableInterface && $context->isActiveRoute()); |
203 | 203 | $langCode = $localeStruct['code']; |
204 | - $path = ($isRoutable ? $context->url($langCode) : ($this->currentUrl() ? : $langCode)); |
|
204 | + $path = ($isRoutable ? $context->url($langCode) : ($this->currentUrl() ?: $langCode)); |
|
205 | 205 | |
206 | 206 | if ($path instanceof UriInterface) { |
207 | 207 | $path = $path->getPath(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | |
89 | - $segments[$key] = (string)$value; |
|
89 | + $segments[$key] = (string) $value; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $segments; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | final public function documentTitle() |
130 | 130 | { |
131 | 131 | $parts = $this->documentTitleParts(); |
132 | - if (array_diff_key([ 'title' => true, 'site' => true ], $parts)) { |
|
132 | + if (array_diff_key(['title' => true, 'site' => true], $parts)) { |
|
133 | 133 | throw new InvalidArgumentException( |
134 | 134 | 'The document title parts requires at least a "title" and a "site"' |
135 | 135 | ); |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $now = new DateTime(); |
54 | 54 | $loader = $this->all(); |
55 | - $loader->addFilter('publishDate', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
56 | - ->addFilter('expiryDate', $now->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
55 | + $loader->addFilter('publishDate', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
56 | + ->addFilter('expiryDate', $now->format('Y-m-d H:i:s'), ['operator' => '>=']); |
|
57 | 57 | |
58 | 58 | return $loader; |
59 | 59 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | { |
66 | 66 | $now = new DateTime(); |
67 | 67 | $loader = $this->all(); |
68 | - $loader->addFilter('publishDate', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
69 | - ->addFilter('expiryDate', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]); |
|
68 | + $loader->addFilter('publishDate', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
69 | + ->addFilter('expiryDate', $now->format('Y-m-d H:i:s'), ['operator' => '<=']); |
|
70 | 70 | |
71 | 71 | return $loader; |
72 | 72 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | if (isset($contextObject['active'])) { |
135 | - return (bool)$contextObject['active']; |
|
135 | + return (bool) $contextObject['active']; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return true; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | if ($route->getRouteOptionsIdent()) { |
453 | 453 | $loader->addFilter('route_options_ident', $route->getRouteOptionsIdent()); |
454 | 454 | } else { |
455 | - $loader->addFilter('route_options_ident', '', [ 'operator' => 'IS NULL' ]); |
|
455 | + $loader->addFilter('route_options_ident', '', ['operator' => 'IS NULL']); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | return $loader->load()->first(); |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | if (isset($available[$code])) { |
524 | 524 | $locale = $available[$code]; |
525 | 525 | if (isset($locale['locales'])) { |
526 | - $choices = (array)$locale['locales']; |
|
526 | + $choices = (array) $locale['locales']; |
|
527 | 527 | array_push($locales, ...$choices); |
528 | 528 | } elseif (isset($locale['locale'])) { |
529 | 529 | array_push($locales, $locale['locale']); |