@@ -166,7 +166,7 @@ |
||
166 | 166 | /** |
167 | 167 | * Retrieve the canonical URI of the object. |
168 | 168 | * |
169 | - * @return \Psr\Http\Message\UriInterface|string|null |
|
169 | + * @return UriInterface|null |
|
170 | 170 | */ |
171 | 171 | public function canonicalUrl() |
172 | 172 | { |
@@ -12,7 +12,6 @@ |
||
12 | 12 | use Pimple\Container; |
13 | 13 | |
14 | 14 | // From 'charcoal-core' |
15 | -use Charcoal\Model\ModelInterface; |
|
16 | 15 | |
17 | 16 | // From 'charcoal-translator' |
18 | 17 | use Charcoal\Translator\TranslatorAwareTrait; |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | $title = null; |
198 | 198 | |
199 | 199 | if ($context instanceof MetatagInterface) { |
200 | - $title = (string)$context['metaTitle']; |
|
200 | + $title = (string) $context['metaTitle']; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if (!$title) { |
204 | - $title = (string)$this->fallbackMetaTitle(); |
|
204 | + $title = (string) $this->fallbackMetaTitle(); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $title; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | protected function fallbackMetaTitle() |
218 | 218 | { |
219 | - return (string)$this->title(); |
|
219 | + return (string) $this->title(); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | |
231 | 231 | $desc = null; |
232 | 232 | if ($context instanceof MetatagInterface) { |
233 | - $desc = (string)$context['metaDescription']; |
|
233 | + $desc = (string) $context['metaDescription']; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | if (!$desc) { |
237 | - $desc = (string)$this->fallbackMetaDescription(); |
|
237 | + $desc = (string) $this->fallbackMetaDescription(); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | return $desc; |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | |
264 | 264 | $img = null; |
265 | 265 | if ($context instanceof MetatagInterface) { |
266 | - $img = (string)$context['metaImage']; |
|
266 | + $img = (string) $context['metaImage']; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | if (!$img) { |
270 | - $img = (string)$this->fallbackMetaImage(); |
|
270 | + $img = (string) $this->fallbackMetaImage(); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return $this->resolveMetaImage($img); |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | |
343 | 343 | $img = null; |
344 | 344 | if ($context instanceof MetatagInterface) { |
345 | - $img = (string)$context['opengraphImage']; |
|
345 | + $img = (string) $context['opengraphImage']; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | if (!$img) { |
349 | - $img = (string)$this->fallbackOpengraphImage(); |
|
349 | + $img = (string) $this->fallbackOpengraphImage(); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | if ($img) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | $this->seoMetadata[] = [ |
414 | 414 | 'name' => $key, |
415 | - 'content' => (string)$value |
|
415 | + 'content' => (string) $value |
|
416 | 416 | ]; |
417 | 417 | } |
418 | 418 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | } else { |
508 | 508 | $parts = parse_url($uri); |
509 | 509 | if (!isset($parts['scheme'])) { |
510 | - if (!in_array($uri[0], [ '/', '#', '?' ])) { |
|
510 | + if (!in_array($uri[0], ['/', '#', '?'])) { |
|
511 | 511 | $path = isset($parts['path']) ? $parts['path'] : ''; |
512 | 512 | $query = isset($parts['query']) ? $parts['query'] : ''; |
513 | 513 | $hash = isset($parts['fragment']) ? $parts['fragment'] : ''; |
@@ -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 | } |