Passed
Push — master ( 60c6e9...764fcb )
by Arnaud
05:07
created
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 (
30 30
                 $page->getVariable('published') === true
31 31
                 && $page->isVirtual() === false
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $options['descTitle'] = $options['descTitle'] ?? false;
62 62
         $options['reverse'] = $options['reverse'] ?? false;
63 63
 
64
-        $pages = $this->usort(function ($a, $b) use ($options) {
64
+        $pages = $this->usort(function($a, $b) use ($options) {
65 65
             if ($a[$options['variable']] == $b[$options['variable']]) {
66 66
                 // if dates are equal and "descTitle" is true
67 67
                 if ($options['descTitle'] && (isset($a['title']) && isset($b['title']))) {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $options['reverse'] = false;
91 91
         }
92 92
 
93
-        return $this->usort(function ($a, $b) use ($options) {
93
+        return $this->usort(function($a, $b) use ($options) {
94 94
             return ($options['reverse'] ? -1 : 1) * strnatcmp($a['title'], $b['title']);
95 95
         });
96 96
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             $options['reverse'] = false;
106 106
         }
107 107
 
108
-        return $this->usort(function ($a, $b) use ($options) {
108
+        return $this->usort(function($a, $b) use ($options) {
109 109
             if ($a['weight'] == $b['weight']) {
110 110
                 return 0;
111 111
             }
Please login to merge, or discard this patch.
src/Collection/Page/Page.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
     public static function createIdFromFile(SplFileInfo $file): string
110 110
     {
111 111
         $relativePath = self::slugify(str_replace(DIRECTORY_SEPARATOR, '/', $file->getRelativePath()));
112
-        $basename = self::slugify(PrefixSuffix::subPrefix($file->getBasename('.' . $file->getExtension())));
112
+        $basename = self::slugify(PrefixSuffix::subPrefix($file->getBasename('.'.$file->getExtension())));
113 113
         // case of "README" -> index
114 114
         $basename = (string) str_ireplace('readme', 'index', $basename);
115 115
         // case of section's index: "section/index" -> "section"
116 116
         if (!empty($relativePath) && PrefixSuffix::sub($basename) == 'index') {
117 117
             // case of a localized section: "section/index.fr" -> "section.fr"
118 118
             if (PrefixSuffix::hasSuffix($basename)) {
119
-                return $relativePath . '.' . PrefixSuffix::getSuffix($basename);
119
+                return $relativePath.'.'.PrefixSuffix::getSuffix($basename);
120 120
             }
121 121
 
122 122
             return $relativePath;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
          */
147 147
         $fileRelativePath = str_replace(DIRECTORY_SEPARATOR, '/', $this->file->getRelativePath());
148 148
         $fileExtension = $this->file->getExtension();
149
-        $fileName = $this->file->getBasename('.' . $fileExtension);
149
+        $fileName = $this->file->getBasename('.'.$fileExtension);
150 150
         // case of "README" -> "index"
151 151
         $fileName = (string) str_ireplace('readme', 'index', $fileName);
152 152
         // case of "index" = home page
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
          */
159 159
         $this->setFolder($fileRelativePath); // ie: "blog"
160 160
         $this->setSlug($fileName); // ie: "post-1"
161
-        $this->setPath($this->getFolder() . '/' . $this->getSlug()); // ie: "blog/post-1"
161
+        $this->setPath($this->getFolder().'/'.$this->getSlug()); // ie: "blog/post-1"
162 162
         /*
163 163
          * Set default variables
164 164
          */
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
         // force slug and update path
297 297
         if ($this->slug && $this->slug != $slug) {
298
-            $this->setPath($this->getFolder() . '/' . $slug);
298
+            $this->setPath($this->getFolder().'/'.$slug);
299 299
         }
300 300
         $this->slug = $slug;
301 301
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 if ($value != $slugify) {
561 561
                     throw new RuntimeException(\sprintf('"%s" variable should be "%s" (not "%s") in "%s".', $name, $slugify, (string) $value, $this->getId()));
562 562
                 }
563
-                $method = 'set' . \ucfirst($name);
563
+                $method = 'set'.\ucfirst($name);
564 564
                 $this->$method($value);
565 565
                 break;
566 566
             default:
Please login to merge, or discard this patch.
src/Collection/Page/Parser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
                 throw new RuntimeException('Cannot read file');
58 58
             }
59 59
             preg_match(
60
-                '/' . self::PATTERN . '/s',
60
+                '/'.self::PATTERN.'/s',
61 61
                 $this->file->getContents(),
62 62
                 $matches
63 63
             );
Please login to merge, or discard this patch.
src/Collection/Page/PrefixSuffix.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
     // https://regex101.com/r/GlgBdT/7
29 29
     // ie: "blog/2017-10-19_post-1.en.md" suffix is "en"
30 30
     // ie: "projet/1-projet-a.fr-FR.md" suffix is "fr-FR"
31
-    public const SUFFIX_PATTERN = '(.*)\.' . Config::LANG_CODE_PATTERN;
31
+    public const SUFFIX_PATTERN = '(.*)\.'.Config::LANG_CODE_PATTERN;
32 32
 
33 33
     /**
34 34
      * Returns true if the string contains a prefix or a suffix.
35 35
      */
36 36
     protected static function has(string $string, string $type): bool
37 37
     {
38
-        return (bool) preg_match('/^' . self::getPattern($type) . '$/', $string);
38
+        return (bool) preg_match('/^'.self::getPattern($type).'$/', $string);
39 39
     }
40 40
 
41 41
     /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     protected static function get(string $string, string $type): ?string
61 61
     {
62 62
         if (self::has($string, $type)) {
63
-            preg_match('/^' . self::getPattern($type) . '$/', $string, $matches);
63
+            preg_match('/^'.self::getPattern($type).'$/', $string, $matches);
64 64
             switch ($type) {
65 65
                 case 'prefix':
66 66
                     return $matches[2];
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
     public static function sub(string $string): string
95 95
     {
96 96
         if (self::hasPrefix($string)) {
97
-            preg_match('/^' . self::getPattern('prefix') . '$/', $string, $matches);
97
+            preg_match('/^'.self::getPattern('prefix').'$/', $string, $matches);
98 98
 
99
-            $string = $matches[1] . $matches[7];
99
+            $string = $matches[1].$matches[7];
100 100
         }
101 101
         if (self::hasSuffix($string)) {
102
-            preg_match('/^' . self::getPattern('suffix') . '$/', $string, $matches);
102
+            preg_match('/^'.self::getPattern('suffix').'$/', $string, $matches);
103 103
 
104 104
             $string = $matches[1];
105 105
         }
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
     public static function subPrefix(string $string): string
114 114
     {
115 115
         if (self::hasPrefix($string)) {
116
-            preg_match('/^' . self::getPattern('prefix') . '$/', $string, $matches);
116
+            preg_match('/^'.self::getPattern('prefix').'$/', $string, $matches);
117 117
 
118
-            return $matches[1] . $matches[7];
118
+            return $matches[1].$matches[7];
119 119
         }
120 120
 
121 121
         return $string;
Please login to merge, or discard this patch.