Passed
Push — sort ( 228a35...de932a )
by Arnaud
03:37
created
src/Step/Pages/Render.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Renderer/Twig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,10 +100,10 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Assets/Asset.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,25 +71,25 @@  discard block
 block discarded – undo
71 71
         $this->builder = $builder;
72 72
         $this->config = $builder->getConfig();
73 73
         $paths = is_array($paths) ? $paths : [$paths];
74
-        array_walk($paths, function ($path) {
74
+        array_walk($paths, function($path) {
75 75
             if (empty($path)) {
76 76
                 throw new RuntimeException('The path parameter of "asset() can\'t be empty."');
77 77
             }
78 78
         });
79 79
         $this->data = [
80
-            'file'           => '',    // absolute file path
81
-            'filename'       => '',    // filename
82
-            'path_source'    => '',    // public path to the file, before transformations
83
-            'path'           => '',    // public path to the file, after transformations
80
+            'file'           => '', // absolute file path
81
+            'filename'       => '', // filename
82
+            'path_source'    => '', // public path to the file, before transformations
83
+            'path'           => '', // public path to the file, after transformations
84 84
             'missing'        => false, // if file not found, but missing ollowed 'missing' is true
85
-            'ext'            => '',    // file extension
86
-            'type'           => '',    // file type (e.g.: image, audio, video, etc.)
87
-            'subtype'        => '',    // file media type (e.g.: image/png, audio/mp3, etc.)
88
-            'size'           => 0,     // file size (in bytes)
89
-            'content_source' => '',    // file content, before transformations
90
-            'content'        => '',    // file content, after transformations
91
-            'width'          => 0,     // width (in pixels) in case of an image
92
-            'height'         => 0,     // height (in pixels) in case of an image
85
+            'ext'            => '', // file extension
86
+            'type'           => '', // file type (e.g.: image, audio, video, etc.)
87
+            'subtype'        => '', // file media type (e.g.: image/png, audio/mp3, etc.)
88
+            'size'           => 0, // file size (in bytes)
89
+            'content_source' => '', // file content, before transformations
90
+            'content'        => '', // file content, after transformations
91
+            'width'          => 0, // width (in pixels) in case of an image
92
+            'height'         => 0, // height (in pixels) in case of an image
93 93
         ];
94 94
 
95 95
         // handles options
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
             try {
436 436
                 $img = ImageManager::make($assetResized->data['content_source']);
437
-                $img->resize($width, null, function (\Intervention\Image\Constraint $constraint) {
437
+                $img->resize($width, null, function(\Intervention\Image\Constraint $constraint) {
438 438
                     $constraint->aspectRatio();
439 439
                     $constraint->upsize();
440 440
                 });
Please login to merge, or discard this patch.
config/default.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
     'title'        => 'Site title',
17 17
     //'baseline'     => 'Site baseline',
18 18
     'baseurl'      => 'http://localhost:8000/',
19
-    'canonicalurl' => false,   // if true 'url()' function preprends URL wirh 'baseurl'
19
+    'canonicalurl' => false, // if true 'url()' function preprends URL wirh 'baseurl'
20 20
     'description'  => 'Site description',
21
-    'taxonomies'   => [        // default taxonomies
21
+    'taxonomies'   => [// default taxonomies
22 22
         'tags'       => 'tag', // can be disabled with 'disabled' value
23 23
         'categories' => 'category',
24 24
     ],
25 25
     'pagination' => [
26
-        'max'  => 5,      // number of pages on each paginated pages
26
+        'max'  => 5, // number of pages on each paginated pages
27 27
         'path' => 'page', // path to paginated pages. ie: '/blog/page/2/'
28 28
     ],
29 29
     'date' => [
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
         'format' => 'yaml', // front matter format `yaml`, `ini`, `toml` or `json` (`yaml` by default)
182 182
     ],
183 183
     'body' => [
184
-        'format'    => 'md',         // page body format (only Markdown is supported)
184
+        'format'    => 'md', // page body format (only Markdown is supported)
185 185
         'toc'       => ['h2', 'h3'], // headers used to build the table of contents
186 186
         'highlight' => [
187
-            'enabled' => false,  // enables code syntax highlighting (`false` by default)
187
+            'enabled' => false, // enables code syntax highlighting (`false` by default)
188 188
         ],
189 189
         'images' => [
190 190
             'lazy' => [
191
-                'enabled' => true,  // adds `loading="lazy"` attribute (`true` by default)
191
+                'enabled' => true, // adds `loading="lazy"` attribute (`true` by default)
192 192
             ],
193 193
             'resize' => [
194 194
                 'enabled' => false, // enables image resizing by using the `width` extra attribute (`false` by default)
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 'enabled' => false, // puts the image in a <figure> element and adds a <figcaption> containing the title (`false` by default)
204 204
             ],
205 205
             'remote' => [
206
-                'enabled' => true,  // turns remote images to Asset to handling them (`true` by default)
206
+                'enabled' => true, // turns remote images to Asset to handling them (`true` by default)
207 207
             ],
208 208
         ],
209 209
     ],
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
     ],
241 241
     'assets' => [
242 242
         'dir'     => 'assets',
243
-        'compile' => [ // Compile Saas
243
+        'compile' => [// Compile Saas
244 244
             'enabled'   => true,
245 245
             'style'     => 'expanded', // 'expanded' or 'compressed',
246 246
             'import'    => ['sass', 'scss', 'node_modules'],
247 247
             'sourcemap' => false, // works in debug mode only
248 248
             //'variables' => ['var' => 'value']
249 249
         ],
250
-        'minify' => [ // Minify CSS and JS
250
+        'minify' => [// Minify CSS and JS
251 251
             'enabled' => true,
252 252
         ],
253
-        'fingerprint' => [ // Add fingerprint
253
+        'fingerprint' => [// Add fingerprint
254 254
             'enabled' => true,
255 255
         ],
256 256
         'target' => 'assets', // target directory of remote and resized assets
Please login to merge, or discard this patch.
src/Assets/Url.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@
 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?
Please login to merge, or discard this patch.
src/Collection/Page/Collection.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $options['descTitle'] = $options['descTitle'] ?? false;
60 60
         $options['reverse'] = $options['reverse'] ?? false;
61 61
 
62
-        return $this->usort(function ($a, $b) use ($options) {
62
+        return $this->usort(function($a, $b) use ($options) {
63 63
             if ($a[$options['variable']] == $b[$options['variable']]) {
64 64
                 // if dates are equal and "descTitle" is true
65 65
                 if ($options['descTitle'] && (isset($a['title']) && isset($b['title']))) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             $options['reverse'] = false;
84 84
         }
85 85
 
86
-        return $this->usort(function ($a, $b) use ($options) {
86
+        return $this->usort(function($a, $b) use ($options) {
87 87
             return ($options['reverse'] ? -1 : 1) * strnatcmp($a['title'], $b['title']);
88 88
         });
89 89
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $options['reverse'] = false;
99 99
         }
100 100
 
101
-        return $this->usort(function ($a, $b) use ($options) {
101
+        return $this->usort(function($a, $b) use ($options) {
102 102
             if ($a['weight'] == $b['weight']) {
103 103
                 return 0;
104 104
             }
Please login to merge, or discard this patch.
src/Renderer/Twig/Extension.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function filterBy(PagesCollection $pages, string $variable, string $value): CollectionInterface
215 215
     {
216
-        $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) {
216
+        $filteredPages = $pages->filter(function(Page $page) use ($variable, $value) {
217 217
             // is a dedicated getter exists?
218 218
             $method = 'get'.ucfirst($variable);
219 219
             if (method_exists($page, $method) && $page->$method() == $value) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public function sortByWeight(\Traversable $collection, bool $reverse = false): array
249 249
     {
250
-        $callback = function ($a, $b) use ($reverse) {
250
+        $callback = function($a, $b) use ($reverse) {
251 251
             if (!isset($a['weight'])) {
252 252
                 $a['weight'] = 0;
253 253
             }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      */
274 274
     public function sortByDate(\Traversable $collection, string $variable = 'date', bool $reverse = false, bool $descTitle = false): array
275 275
     {
276
-        $callback = function ($a, $b) use ($variable, $reverse, $descTitle) {
276
+        $callback = function($a, $b) use ($variable, $reverse, $descTitle) {
277 277
             if ($a[$variable] == $b[$variable]) {
278 278
                 // if dates are equal and "descTitle" is true
279 279
                 if ($descTitle && (isset($a['title']) && isset($b['title']))) {
Please login to merge, or discard this patch.