Passed
Push — master ( 60c6e9...764fcb )
by Arnaud
05:07
created
src/Step/Data/Load.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $files = Finder::create()
55 55
             ->files()
56 56
             ->in($this->builder->getConfig()->getDataPath())
57
-            ->name('/\.(' . implode('|', (array) $this->builder->getConfig()->get('data.ext')) . ')$/')
57
+            ->name('/\.('.implode('|', (array) $this->builder->getConfig()->get('data.ext')).')$/')
58 58
             ->sortByName(true);
59 59
         $total = count($files);
60 60
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         foreach ($files as $file) {
76 76
             $count++;
77 77
             set_error_handler(
78
-                function ($severity, $message, $file, $line) {
78
+                function($severity, $message, $file, $line) {
79 79
                     throw new \ErrorException($message, 0, $severity, $file, $line, null);
80 80
                 }
81 81
             );
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                     return;
101 101
             }
102 102
 
103
-            $basename = $file->getBasename('.' . $file->getExtension());
103
+            $basename = $file->getBasename('.'.$file->getExtension());
104 104
             $subpath = \Cecil\Util\File::getFS()->makePathRelative(
105 105
                 $file->getPath(),
106 106
                 $this->builder->getConfig()->getDataPath()
Please login to merge, or discard this patch.
src/Step/StaticFiles/Load.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
             $staticFiles[$count]['date'] = (new \DateTime())->setTimestamp($file->getCTime());
71 71
             $staticFiles[$count]['updated'] = (new \DateTime())->setTimestamp($file->getMTime());
72 72
             $staticFiles[$count]['name'] = $file->getBasename();
73
-            $staticFiles[$count]['basename'] = $file->getBasename('.' . $file->getExtension());
73
+            $staticFiles[$count]['basename'] = $file->getBasename('.'.$file->getExtension());
74 74
             $staticFiles[$count]['ext'] = $file->getExtension();
75 75
             $count++;
76 76
 
Please login to merge, or discard this patch.
src/Step/Pages/Render.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         /** @var Collection $pages */
67 67
         $pages = $this->builder->getPages()
68 68
             // published only
69
-            ->filter(function (Page $page) {
69
+            ->filter(function(Page $page) {
70 70
                 return (bool) $page->getVariable('published');
71 71
             })
72 72
             // enrichs some variables
73
-            ->map(function (Page $page) {
73
+            ->map(function(Page $page) {
74 74
                 $formats = $this->getOutputFormats($page);
75 75
                 // output formats
76 76
                 $page->setVariable('output', $formats);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                 // renders with Twig
126 126
                 try {
127 127
                     $deprecations = [];
128
-                    set_error_handler(function ($type, $msg) use (&$deprecations) {
128
+                    set_error_handler(function($type, $msg) use (&$deprecations) {
129 129
                         if (E_USER_DEPRECATED === $type) {
130 130
                             $deprecations[] = $msg;
131 131
                         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         // ```yaml
236 236
         // page: [html, json]
237 237
         // ```
238
-        $formats = $this->config->get('output.pagetypeformats.' . $page->getType());
238
+        $formats = $this->config->get('output.pagetypeformats.'.$page->getType());
239 239
         if (empty($formats)) {
240 240
             throw new RuntimeException('Configuration key "pagetypeformats" can\'t be empty.');
241 241
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      */
274 274
     protected function getTranslations(Page $refPage): \Cecil\Collection\Page\Collection
275 275
     {
276
-        $pages = $this->builder->getPages()->filter(function (Page $page) use ($refPage) {
276
+        $pages = $this->builder->getPages()->filter(function(Page $page) use ($refPage) {
277 277
             return $page->getId() !== $refPage->getId()
278 278
                 && $page->getVariable('langref') == $refPage->getVariable('langref')
279 279
                 && $page->getType() == $refPage->getType()
@@ -294,15 +294,15 @@  discard block
 block discarded – undo
294 294
                 // add generator meta tag
295 295
                 if (!preg_match('/<meta name="generator".*/i', $output)) {
296 296
                     $meta = \sprintf('<meta name="generator" content="Cecil %s" />', Builder::getVersion());
297
-                    $output = preg_replace_callback('/([[:blank:]]*)(<\/head>)/i', function ($matches) use ($meta) {
298
-                        return str_repeat($matches[1] ?: ' ', 2) . $meta . "\n" . $matches[1] . $matches[2];
297
+                    $output = preg_replace_callback('/([[:blank:]]*)(<\/head>)/i', function($matches) use ($meta) {
298
+                        return str_repeat($matches[1] ?: ' ', 2).$meta."\n".$matches[1].$matches[2];
299 299
                     }, $output);
300 300
                 }
301 301
                 // replace excerpt or break tag by HTML anchor
302 302
                 // https://regex101.com/r/Xl7d5I/3
303 303
                 $pattern = '(.*)(<!--[[:blank:]]?(excerpt|break)[[:blank:]]?-->)(.*)';
304 304
                 $replacement = '$1<span id="more"></span>$4';
305
-                $excerpt = preg_replace('/' . $pattern . '/is', $replacement, $output, 1);
305
+                $excerpt = preg_replace('/'.$pattern.'/is', $replacement, $output, 1);
306 306
                 $output = $excerpt ?? $output;
307 307
         }
308 308
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             //'/href="([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is',
313 313
             // https://regex101.com/r/ycWMe4/1
314 314
             '/href="(\/|)([A-Za-z0-9_\.\-\/]+)\.md(\#[A-Za-z0-9\-]+)?"/is',
315
-            function ($matches) use ($page) {
315
+            function($matches) use ($page) {
316 316
                 // section spage
317 317
                 $hrefPattern = 'href="../%s/%s"';
318 318
                 // root page
Please login to merge, or discard this patch.
src/Step/Pages/Load.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function process(): void
59 59
     {
60
-        $namePattern = '/\.(' . implode('|', (array) $this->builder->getConfig()->get('pages.ext')) . ')$/';
60
+        $namePattern = '/\.('.implode('|', (array) $this->builder->getConfig()->get('pages.ext')).')$/';
61 61
         $content = Finder::create()
62 62
             ->files()
63 63
             ->in($this->builder->getConfig()->getPagesPath())
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                 $this->builder->getLogger()->error(sprintf('File "%s" doesn\'t exist.', $this->page));
81 81
             }
82 82
             $content->path('.')->path(dirname($this->page));
83
-            $content->name('/index\.(' . implode('|', (array) $this->builder->getConfig()->get('pages.ext')) . ')$/');
83
+            $content->name('/index\.('.implode('|', (array) $this->builder->getConfig()->get('pages.ext')).')$/');
84 84
             $namePattern = basename($this->page);
85 85
         }
86 86
         $content->name($namePattern);
Please login to merge, or discard this patch.
src/Converter/Parsedown.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
         // GitHub Gist link?
145 145
         // https://regex101.com/r/QmCiAL/1
146 146
         $pattern = 'https:\/\/gist\.github.com\/[-a-zA-Z0-9_]+\/[-a-zA-Z0-9_]+';
147
-        if (preg_match('/' . $pattern . '/is', (string) $link['element']['attributes']['href'], $matches)) {
147
+        if (preg_match('/'.$pattern.'/is', (string) $link['element']['attributes']['href'], $matches)) {
148 148
             $gist = [
149 149
                 'extent'  => $link['extent'],
150 150
                 'element' => [
151 151
                     'name'       => 'script',
152 152
                     'text'       => $link['element']['text'],
153 153
                     'attributes' => [
154
-                        'src'   => $matches[0] . '.js',
154
+                        'src'   => $matches[0].'.js',
155 155
                         'title' => $link['element']['attributes']['title'],
156 156
                     ],
157 157
                 ],
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
         // Youtube link?
166 166
         // https://regex101.com/r/gznM1j/1
167 167
         $pattern = '(?:https?:\/\/)?(?:www\.)?youtu(?:\.be\/|be.com\/\S*(?:watch|embed)(?:(?:(?=\/[-a-zA-Z0-9_]{11,}(?!\S))\/)|(?:\S*v=|v\/)))([-a-zA-Z0-9_]{11,})';
168
-        if (preg_match('/' . $pattern . '/is', (string) $link['element']['attributes']['href'], $matches)) {
168
+        if (preg_match('/'.$pattern.'/is', (string) $link['element']['attributes']['href'], $matches)) {
169 169
             $iframe = [
170 170
                 'element' => [
171 171
                     'name'       => 'iframe',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                         'width'           => '560',
175 175
                         'height'          => '315',
176 176
                         'title'           => $link['element']['text'],
177
-                        'src'             => 'https://www.youtube.com/embed/' . $matches[1],
177
+                        'src'             => 'https://www.youtube.com/embed/'.$matches[1],
178 178
                         'frameborder'     => '0',
179 179
                         'allow'           => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture',
180 180
                         'allowfullscreen' => '',
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
         // add default class?
231 231
         if ((string) $this->builder->getConfig()->get('body.images.class')) {
232
-            $InlineImage['element']['attributes']['class'] .= ' ' . (string) $this->builder->getConfig()->get('body.images.class');
232
+            $InlineImage['element']['attributes']['class'] .= ' '.(string) $this->builder->getConfig()->get('body.images.class');
233 233
             $InlineImage['element']['attributes']['class'] = trim($InlineImage['element']['attributes']['class']);
234 234
         }
235 235
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 
448 448
             return $block;
449 449
         }
450
-        $block['element']['text'] .= $line['text'] . "\n";
450
+        $block['element']['text'] .= $line['text']."\n";
451 451
 
452 452
         return $block;
453 453
     }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             (string) $this->builder->getConfig()->get('assets.dir')
551 551
         );
552 552
         $path = Util::joinPath($path);
553
-        if (!preg_match('/' . $pattern . '/is', $path, $matches)) {
553
+        if (!preg_match('/'.$pattern.'/is', $path, $matches)) {
554 554
             return $path;
555 555
         }
556 556
 
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     public function getHelp()
35 35
     {
36
-        return self::$banner . parent::getHelp();
36
+        return self::$banner.parent::getHelp();
37 37
     }
38 38
 
39 39
     /**
Please login to merge, or discard this patch.
src/Assets/Cache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             );
208 208
             foreach ($iterator as $file) {
209 209
                 if ($file->isFile()) {
210
-                    if (preg_match('/' . $pattern . '/i', $file->getBasename())) {
210
+                    if (preg_match('/'.$pattern.'/i', $file->getBasename())) {
211 211
                         Util\File::getFS()->remove($file->getPathname());
212 212
                         $fileCount++;
213 213
                         $this->builder->getLogger()->debug(\sprintf('Cache file "%s" removed', $file->getPathname()));
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         try {
240 240
             $keyAsArray = explode('__', $this->prepareKey($key), -1);
241 241
             if (!empty($keyAsArray)) {
242
-                $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]) . '*';
242
+                $pattern = Util::joinFile($this->cacheDir, $keyAsArray[0]).'*';
243 243
                 foreach (glob($pattern) as $filename) {
244 244
                     Util\File::getFS()->remove($filename);
245 245
                 }
Please login to merge, or discard this patch.
src/Assets/Url.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 
62 62
         // handles options
63 63
         $canonical = null; // if true, add prefix URL with baseurl
64
-        $format = null;    // set output format
65
-        $language = null;  // force language
64
+        $format = null; // set output format
65
+        $language = null; // force language
66 66
         extract(is_array($options) ? $options : [], EXTR_IF_EXISTS);
67 67
 
68 68
         // canonical URL?
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         // value is empty (i.e.: `url()`)
78 78
         if (is_null($value) || empty($value) || $value == '/') {
79
-            $this->url = $base . '/';
79
+            $this->url = $base.'/';
80 80
 
81 81
             return;
82 82
         }
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
                         $format = 'html'; // 'html' format by default
93 93
                     }
94 94
                 }
95
-                $this->url = $base . '/' . ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/');
95
+                $this->url = $base.'/'.ltrim((new PageRenderer($this->config))->getUrl($value, $format), '/');
96 96
                 break;
97 97
             case $value instanceof Asset:
98
-                $this->url = $base . '/' . ltrim($value['path'], '/');
98
+                $this->url = $base.'/'.ltrim($value['path'], '/');
99 99
                 break;
100 100
             case is_string($value):
101 101
                 // potential Page ID
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                         );
119 119
                         break;
120 120
                     default:
121
-                        $this->url = $base . '/' . $lang . ltrim($value, '/');
121
+                        $this->url = $base.'/'.$lang.ltrim($value, '/');
122 122
                 }
123 123
         }
124 124
     }
Please login to merge, or discard this patch.
src/Assets/Image.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $format = 'webp';
63 63
         $image = ImageManager::make($assetWebp['content']);
64 64
         $assetWebp['content'] = (string) $image->encode($format, $quality);
65
-        $assetWebp['path'] = preg_replace('/\.' . $asset['ext'] . '$/m', ".$format", $asset['path']);
65
+        $assetWebp['path'] = preg_replace('/\.'.$asset['ext'].'$/m', ".$format", $asset['path']);
66 66
         $assetWebp['ext'] = $format;
67 67
 
68 68
         return $assetWebp;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $classArray = explode(' ', $class);
111 111
         foreach ($classArray as $class) {
112 112
             if (array_key_exists($class, $config)) {
113
-                $result = $config[$class] . ', ';
113
+                $result = $config[$class].', ';
114 114
             }
115 115
         }
116 116
         if (!empty($result)) {
Please login to merge, or discard this patch.