@@ -67,7 +67,7 @@ |
||
67 | 67 | $language = ''; |
68 | 68 | } |
69 | 69 | |
70 | - return \Cecil\Util::joinPath($language, $path, $subpath, $filename) . $extension; |
|
70 | + return \Cecil\Util::joinPath($language, $path, $subpath, $filename).$extension; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface |
214 | 214 | { |
215 | - $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { |
|
215 | + $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) { |
|
216 | 216 | // is a dedicated getter exists? |
217 | - $method = 'get' . ucfirst($variable); |
|
217 | + $method = 'get'.ucfirst($variable); |
|
218 | 218 | if (method_exists($page, $method) && $page->$method() == $value) { |
219 | 219 | return $page->getType() == Type::PAGE() && !$page->isVirtual() && true; |
220 | 220 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function sortByWeight(\Traversable $collection): array |
247 | 247 | { |
248 | - $callback = function ($a, $b) { |
|
248 | + $callback = function($a, $b) { |
|
249 | 249 | if (!isset($a['weight'])) { |
250 | 250 | $a['weight'] = 0; |
251 | 251 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | public function sortByDate(\Traversable $collection, string $variable = 'date', bool $descTitle = false): array |
272 | 272 | { |
273 | - $callback = function ($a, $b) use ($variable, $descTitle) { |
|
273 | + $callback = function($a, $b) use ($variable, $descTitle) { |
|
274 | 274 | if ($a[$variable] == $b[$variable]) { |
275 | 275 | // if dates are equal and "descTitle" is true |
276 | 276 | if ($descTitle && (isset($a['title']) && isset($b['title']))) { |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // <img> element |
559 | 559 | $img = \sprintf( |
560 | - '<img src="%s" width="' . ($asset->getWidth() ?: '') . '" height="' . ($asset->getHeight() ?: '') . '"%s>', |
|
560 | + '<img src="%s" width="'.($asset->getWidth() ?: '').'" height="'.($asset->getHeight() ?: '').'"%s>', |
|
561 | 561 | $this->url($asset, $options), |
562 | 562 | $htmlAttributes |
563 | 563 | ); |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | extract($options, EXTR_IF_EXISTS); |
635 | 635 | |
636 | 636 | // https://regex101.com/r/n9TWHF/1 |
637 | - $pattern = '(.*)<!--[[:blank:]]?(' . $separator . ')[[:blank:]]?-->(.*)'; |
|
638 | - preg_match('/' . $pattern . '/is', $string, $matches); |
|
637 | + $pattern = '(.*)<!--[[:blank:]]?('.$separator.')[[:blank:]]?-->(.*)'; |
|
638 | + preg_match('/'.$pattern.'/is', $string, $matches); |
|
639 | 639 | |
640 | 640 | if (empty($matches)) { |
641 | 641 | return $string; |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | } |
837 | 837 | $hex = ltrim($variable, '#'); |
838 | 838 | if (strlen($hex) == 3) { |
839 | - $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; |
|
839 | + $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; |
|
840 | 840 | } |
841 | 841 | $c = hexdec($hex); |
842 | 842 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | foreach ($this->config->getLanguages() as $language) { |
47 | 47 | $pageId = !empty($path) ? $path : 'index'; |
48 | 48 | if ($language['code'] !== $this->config->getLanguageDefault()) { |
49 | - $pageId .= '.' . $language['code']; |
|
49 | + $pageId .= '.'.$language['code']; |
|
50 | 50 | // disable multilingual support |
51 | 51 | if (isset($frontmatter['multilingual']) && $frontmatter['multilingual'] === false) { |
52 | 52 | continue; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | // filters pages: home, sections and terms |
35 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
35 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
36 | 36 | return in_array($page->getType(), [Type::HOMEPAGE, Type::SECTION, Type::TERM]); |
37 | 37 | }); |
38 | 38 | /** @var Page $page */ |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $paginationPath = $pagePagination['path']; |
62 | 62 | } |
63 | 63 | } |
64 | - $pages = $pages->filter(function (Page $page) { |
|
64 | + $pages = $pages->filter(function(Page $page) { |
|
65 | 65 | return $page->getVariable('published'); |
66 | 66 | }); |
67 | 67 | $pagesTotal = count($pages); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $paginationPerPage |
88 | 88 | ); |
89 | 89 | $pagesInPagination = new PagesCollection( |
90 | - $page->getId() . '-page-' . ($i + 1), |
|
90 | + $page->getId().'-page-'.($i + 1), |
|
91 | 91 | iterator_to_array($pagesInPagination) |
92 | 92 | ); |
93 | 93 | $alteredPage = clone $page; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->builder = $builder; |
40 | 40 | $this->config = $builder->getConfig(); |
41 | 41 | // Creates a new empty collection |
42 | - $this->generatedPages = new PagesCollection('generator-' . Util::formatClassName($this, ['lowercase' => true])); |
|
42 | + $this->generatedPages = new PagesCollection('generator-'.Util::formatClassName($this, ['lowercase' => true])); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -50,7 +50,7 @@ discard block |
||
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 | } |
@@ -65,16 +65,16 @@ |
||
65 | 65 | public static function openBrowser(string $url): void |
66 | 66 | { |
67 | 67 | if (self::isWindows()) { |
68 | - passthru('start "web" explorer "' . $url . '"'); |
|
68 | + passthru('start "web" explorer "'.$url.'"'); |
|
69 | 69 | |
70 | 70 | return; |
71 | 71 | } |
72 | 72 | passthru('which xdg-open', $linux); |
73 | 73 | passthru('which open', $osx); |
74 | 74 | if (0 === $linux) { |
75 | - passthru('xdg-open ' . $url); |
|
75 | + passthru('xdg-open '.$url); |
|
76 | 76 | } elseif (0 === $osx) { |
77 | - passthru('open ' . $url); |
|
77 | + passthru('open '.$url); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $this->options = array_merge([ |
140 | 140 | 'drafts' => false, // build drafts or not |
141 | 141 | 'dry-run' => false, // if dry-run is true, generated files are not saved |
142 | - 'page' => '', // specific page to build |
|
142 | + 'page' => '', // specific page to build |
|
143 | 143 | ], $options); |
144 | 144 | |
145 | 145 | // process each step |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | public static function getVersion(): string |
368 | 368 | { |
369 | 369 | if (!isset(self::$version)) { |
370 | - $filePath = __DIR__ . '/../VERSION'; |
|
370 | + $filePath = __DIR__.'/../VERSION'; |
|
371 | 371 | if (Plateform::isPhar()) { |
372 | - $filePath = Plateform::getPharPath() . '/VERSION'; |
|
372 | + $filePath = Plateform::getPharPath().'/VERSION'; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | try { |
@@ -399,12 +399,12 @@ discard block |
||
399 | 399 | $this->getLogger()->error('The "baseurl" configuration key is required in production (e.g.: "baseurl: https://example.com/").'); |
400 | 400 | } |
401 | 401 | // default language |
402 | - if (!preg_match('/^' . Config::LANG_CODE_PATTERN . '$/', (string) $this->config->get('language'))) { |
|
402 | + if (!preg_match('/^'.Config::LANG_CODE_PATTERN.'$/', (string) $this->config->get('language'))) { |
|
403 | 403 | throw new RuntimeException(\sprintf('The configured default language code "%s" is not valid (e.g.: "language: fr-FR").', $this->config->get('language'))); |
404 | 404 | } |
405 | 405 | // locales |
406 | 406 | foreach ((array) $this->config->get('languages') as $lang) { |
407 | - if (!preg_match('/^' . Config::LANG_LOCALE_PATTERN . '$/', $lang['locale'])) { |
|
407 | + if (!preg_match('/^'.Config::LANG_LOCALE_PATTERN.'$/', $lang['locale'])) { |
|
408 | 408 | throw new RuntimeException(\sprintf('The configured language locale "%s" is not valid (e.g.: "locale: fr_FR").', $lang['locale'])); |
409 | 409 | } |
410 | 410 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * Overrides configuration with environment variables. |
69 | 69 | */ |
70 | 70 | $data = $this->getData(); |
71 | - $applyEnv = function ($array) use ($data) { |
|
71 | + $applyEnv = function($array) use ($data) { |
|
72 | 72 | $iterator = new \RecursiveIteratorIterator( |
73 | 73 | new \RecursiveArrayIterator($array), |
74 | 74 | \RecursiveIteratorIterator::SELF_FIRST |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $path[] = $iterator->getSubIterator($depth)->key(); |
81 | 81 | } |
82 | 82 | $sPath = implode('_', $path); |
83 | - if ($getEnv = getenv('CECIL_' . strtoupper($sPath))) { |
|
83 | + if ($getEnv = getenv('CECIL_'.strtoupper($sPath))) { |
|
84 | 84 | $data->set(str_replace('_', '.', strtolower($sPath)), $this->castSetValue($getEnv)); |
85 | 85 | } |
86 | 86 | $iterator->next(); |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | throw new RuntimeException(\sprintf('The default language "%s" is not listed in "languages" key configuration.', $this->getLanguageDefault())); |
508 | 508 | } |
509 | 509 | |
510 | - $languages = array_filter($languages, function ($language) { |
|
510 | + $languages = array_filter($languages, function($language) { |
|
511 | 511 | return !(isset($language['enabled']) && $language['enabled'] === false); |
512 | 512 | }); |
513 | 513 |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | $page404 = '404.html'; |
75 | 75 | |
76 | 76 | if ($language['code'] !== $this->config->getLanguageDefault()) { |
77 | - $suffix = '.' . $language['code']; |
|
78 | - $page404 = $language['code'] . '/404.html'; |
|
77 | + $suffix = '.'.$language['code']; |
|
78 | + $page404 = $language['code'].'/404.html'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | foreach ($menusConfig as $menuConfig => $entry) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function collectPages(): void |
148 | 148 | { |
149 | - $filteredPages = $this->builder->getPages()->filter(function (Page $page) { |
|
149 | + $filteredPages = $this->builder->getPages()->filter(function(Page $page) { |
|
150 | 150 | return $page->hasVariable('menu') |
151 | 151 | && $page->getVariable('published') |
152 | 152 | && in_array($page->getVariable('language', $this->config->getLanguageDefault()), array_column($this->config->getLanguages(), 'code')); |