@@ -50,7 +50,7 @@ |
||
50 | 50 | $this->generate(); |
51 | 51 | |
52 | 52 | // set default language (e.g.: "en") if necessary |
53 | - $this->generatedPages->map(function (\Cecil\Collection\Page\Page $page) { |
|
53 | + $this->generatedPages->map(function(\Cecil\Collection\Page\Page $page) { |
|
54 | 54 | if ($page->getVariable('language') === null) { |
55 | 55 | $page->setVariable('language', $this->config->getLanguageDefault()); |
56 | 56 | } |
@@ -136,7 +136,7 @@ |
||
136 | 136 | */ |
137 | 137 | public function getPages(): \Cecil\Collection\Page\Collection |
138 | 138 | { |
139 | - return $this->builder->getPages()->filter(function (CollectionPage $page) { |
|
139 | + return $this->builder->getPages()->filter(function(CollectionPage $page) { |
|
140 | 140 | // We should fix case of virtual pages without language |
141 | 141 | if ($page->getVariable('language') === null && $this->language == $this->config->getLanguageDefault()) { |
142 | 142 | return true; |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $page = clone $this->builder->getPages()->get($pageId); |
42 | 42 | } |
43 | 43 | // collects all pages |
44 | - $subPages = $this->builder->getPages()->filter(function (Page $page) use ($language) { |
|
44 | + $subPages = $this->builder->getPages()->filter(function(Page $page) use ($language) { |
|
45 | 45 | return $page->getType() == TYPE::PAGE |
46 | 46 | && $page->isVirtual() === false |
47 | 47 | && $page->getVariable('exclude') !== true |
@@ -76,10 +76,10 @@ |
||
76 | 76 | // i18n |
77 | 77 | $this->twig->addExtension(new IntlExtension()); |
78 | 78 | // filters fallback |
79 | - $this->twig->registerUndefinedFilterCallback(function ($name) { |
|
79 | + $this->twig->registerUndefinedFilterCallback(function($name) { |
|
80 | 80 | switch ($name) { |
81 | 81 | case 'localizeddate': |
82 | - return new \Twig\TwigFilter($name, function (\DateTime $value = null) { |
|
82 | + return new \Twig\TwigFilter($name, function(\DateTime $value = null) { |
|
83 | 83 | return date((string) $this->builder->getConfig()->get('date.format'), $value->getTimestamp()); |
84 | 84 | }); |
85 | 85 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function showable(): self |
27 | 27 | { |
28 | - return $this->filter(function (Page $page) { |
|
28 | + return $this->filter(function(Page $page) { |
|
29 | 29 | if ($page->getVariable('published') === true |
30 | 30 | && $page->isVirtual() === false |
31 | 31 | && $page->getVariable('redirect') === null |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function sortByDate(): self |
50 | 50 | { |
51 | - return $this->usort(function ($a, $b) { |
|
51 | + return $this->usort(function($a, $b) { |
|
52 | 52 | if ($a['date'] == $b['date']) { |
53 | 53 | return 0; |
54 | 54 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function sortByTitle(): self |
64 | 64 | { |
65 | - return $this->usort(function ($a, $b) { |
|
65 | + return $this->usort(function($a, $b) { |
|
66 | 66 | return strnatcmp($a['title'], $b['title']); |
67 | 67 | }); |
68 | 68 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function sortByWeight(): self |
74 | 74 | { |
75 | - return $this->usort(function ($a, $b) { |
|
75 | + return $this->usort(function($a, $b) { |
|
76 | 76 | if ($a['weight'] == $b['weight']) { |
77 | 77 | return 0; |
78 | 78 | } |
@@ -119,8 +119,7 @@ |
||
119 | 119 | $this->url = (string) new self($this->builder, $page, $options); |
120 | 120 | break; |
121 | 121 | // asset as string (i.e.: '*.js', '*.css', '*.jpeg') |
122 | - case false !== strrpos($value, '.') && in_array(strlen($value) - strrpos($value, '.'), [3, 4, 5]) ? true : false: |
|
123 | - $this->url = $base.'/'.ltrim($value, '/'); |
|
122 | + case false !== strrpos($value, '.') && in_array(strlen($value) - strrpos($value, '.'), [3, 4, 5]) ? true : false : $this->url = $base.'/'.ltrim($value, '/'); |
|
124 | 123 | break; |
125 | 124 | // others cases? |
126 | 125 | default: |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface |
213 | 213 | { |
214 | - $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { |
|
214 | + $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) { |
|
215 | 215 | // is a dedicated getter exists? |
216 | 216 | $method = 'get'.ucfirst($variable); |
217 | 217 | if (method_exists($page, $method) && $page->$method() == $value) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function sortByWeight(\Traversable $collection): array |
245 | 245 | { |
246 | - $callback = function ($a, $b) { |
|
246 | + $callback = function($a, $b) { |
|
247 | 247 | if (!isset($a['weight'])) { |
248 | 248 | $a['weight'] = 0; |
249 | 249 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function sortByDate(\Traversable $collection, string $variable = 'date'): array |
271 | 271 | { |
272 | - $callback = function ($a, $b) use ($variable) { |
|
272 | + $callback = function($a, $b) use ($variable) { |
|
273 | 273 | if ($a[$variable] == $b[$variable]) { |
274 | 274 | return 0; |
275 | 275 | } |