@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | // collects published pages |
| 66 | 66 | /** @var Page $page */ |
| 67 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
| 67 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
| 68 | 68 | return !empty($page->getVariable('published')); |
| 69 | 69 | }); |
| 70 | 70 | $max = count($filteredPages); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | // renders with Twig |
| 120 | 120 | try { |
| 121 | 121 | $deprecations = []; |
| 122 | - set_error_handler(function ($type, $msg) use (&$deprecations) { |
|
| 122 | + set_error_handler(function($type, $msg) use (&$deprecations) { |
|
| 123 | 123 | if (E_USER_DEPRECATED === $type) { |
| 124 | 124 | $deprecations[] = $msg; |
| 125 | 125 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | protected function getTranslations(Page $refPage): \Cecil\Collection\Page\Collection |
| 265 | 265 | { |
| 266 | 266 | /** @var Page $page */ |
| 267 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) use ($refPage) { |
|
| 267 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) use ($refPage) { |
|
| 268 | 268 | return $page->getId() !== $refPage->getId() |
| 269 | 269 | && $page->getVariable('langref') == $refPage->getVariable('langref') |
| 270 | 270 | && $page->getType() == $refPage->getType() |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | // add generator meta tag |
| 286 | 286 | if (!preg_match('/<meta name="generator".*/i', $output)) { |
| 287 | 287 | $meta = \sprintf('<meta name="generator" content="Cecil %s" />', Builder::getVersion()); |
| 288 | - $output = preg_replace_callback('/([[:blank:]]+)(<\/head>)/i', function ($matches) use ($meta) { |
|
| 288 | + $output = preg_replace_callback('/([[:blank:]]+)(<\/head>)/i', function($matches) use ($meta) { |
|
| 289 | 289 | return str_repeat($matches[1], 2).$meta."\n".$matches[1].$matches[2]; |
| 290 | 290 | }, $output); |
| 291 | 291 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | //'/href="([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
| 304 | 304 | // https://regex101.com/r/ycWMe4/1 |
| 305 | 305 | '/href="(\/|)([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is', |
| 306 | - function ($matches) use ($page) { |
|
| 306 | + function($matches) use ($page) { |
|
| 307 | 307 | // section spage |
| 308 | 308 | $hrefPattern = 'href="../%s/%s"'; |
| 309 | 309 | // root page |
@@ -100,10 +100,10 @@ |
||
| 100 | 100 | $this->builder->getLogger()->debug('Intl extension is loaded'); |
| 101 | 101 | } |
| 102 | 102 | // filters fallback |
| 103 | - $this->twig->registerUndefinedFilterCallback(function ($name) { |
|
| 103 | + $this->twig->registerUndefinedFilterCallback(function($name) { |
|
| 104 | 104 | switch ($name) { |
| 105 | 105 | case 'localizeddate': |
| 106 | - return new \Twig\TwigFilter($name, function (\DateTime $value = null) { |
|
| 106 | + return new \Twig\TwigFilter($name, function(\DateTime $value = null) { |
|
| 107 | 107 | return date((string) $this->builder->getConfig()->get('date.format'), $value->getTimestamp()); |
| 108 | 108 | }); |
| 109 | 109 | } |