Passed
Push — master ( 39a5d6...80e6cc )
by Sebastian
10:40
created
src/FileHelper/PHPClassInfo.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         self::TYPE_TRAIT
49 49
     );
50 50
 
51
-   /**
52
-    * @param PHPFile $path The path to the PHP file to parse.
53
-    * @throws FileHelper_Exception
54
-    * @see FileHelper::findPHPClasses()
55
-    */
51
+    /**
52
+     * @param PHPFile $path The path to the PHP file to parse.
53
+     * @throws FileHelper_Exception
54
+     * @see FileHelper::findPHPClasses()
55
+     */
56 56
     public function __construct(PHPFile $path)
57 57
     {
58 58
         $this->file = $path
@@ -62,58 +62,58 @@  discard block
 block discarded – undo
62 62
         $this->parseFile();
63 63
     }
64 64
     
65
-   /**
66
-    * The name of the namespace of the classes in the file, if any.
67
-    * @return string
68
-    */
65
+    /**
66
+     * The name of the namespace of the classes in the file, if any.
67
+     * @return string
68
+     */
69 69
     public function getNamespace() : string
70 70
     {
71 71
         return $this->namespace;
72 72
     }
73 73
     
74
-   /**
75
-    * Whether the file contains a namespace.
76
-    * @return bool
77
-    */
74
+    /**
75
+     * Whether the file contains a namespace.
76
+     * @return bool
77
+     */
78 78
     public function hasNamespace() : bool
79 79
     {
80 80
         return !empty($this->namespace);
81 81
     }
82 82
     
83
-   /**
84
-    * The absolute path to the file.
85
-    * @return string
86
-    */
83
+    /**
84
+     * The absolute path to the file.
85
+     * @return string
86
+     */
87 87
     public function getPath() : string
88 88
     {
89 89
         return $this->file->getPath();
90 90
     }
91 91
    
92
-   /**
93
-    * Whether any classes were found in the file.
94
-    * @return bool
95
-    */
92
+    /**
93
+     * Whether any classes were found in the file.
94
+     * @return bool
95
+     */
96 96
     public function hasClasses() : bool
97 97
     {
98 98
         return !empty($this->classes);
99 99
     }
100 100
     
101
-   /**
102
-    * The names of the classes that were found in the file (with namespace if any).
103
-    * @return string[]
104
-    */
101
+    /**
102
+     * The names of the classes that were found in the file (with namespace if any).
103
+     * @return string[]
104
+     */
105 105
     public function getClassNames() : array
106 106
     {
107 107
         return array_keys($this->classes);
108 108
     }
109 109
     
110
-   /**
111
-    * Retrieves all classes that were detected in the file,
112
-    * which can be used to retrieve more information about
113
-    * them.
114
-    * 
115
-    * @return FileHelper_PHPClassInfo_Class[]
116
-    */
110
+    /**
111
+     * Retrieves all classes that were detected in the file,
112
+     * which can be used to retrieve more information about
113
+     * them.
114
+     * 
115
+     * @return FileHelper_PHPClassInfo_Class[]
116
+     */
117 117
     public function getClasses() : array
118 118
     {
119 119
         return array_values($this->classes);
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
         $this->classes[$class->getNameNS()] = $class;
186 186
     }
187 187
 
188
-   /**
189
-    * Strips all whitespace from the string, replacing it with 
190
-    * regular spaces (newlines, tabs, etc.).
191
-    * 
192
-    * @param string $string
193
-    * @return string
194
-    */
188
+    /**
189
+     * Strips all whitespace from the string, replacing it with 
190
+     * regular spaces (newlines, tabs, etc.).
191
+     * 
192
+     * @param string $string
193
+     * @return string
194
+     */
195 195
     protected function stripWhitespace(string $string) : string 
196 196
     {
197 197
         return preg_replace('/\s/', ' ', $string);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
         $this->detectNamespace($code);
127 127
         $result = $this->detectMatches($code);
128 128
 
129
-        if($result === null) {
129
+        if ($result === null) {
130 130
             return;
131 131
         }
132 132
         
133 133
         $indexes = array_keys($result[0]);
134 134
         
135
-        foreach($indexes as $idx)
135
+        foreach ($indexes as $idx)
136 136
         {
137 137
             $this->parseResult(
138 138
                 $result[1][$idx],
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         preg_match_all('/(abstract|final)\s+('.$types.')\s+([\sa-z\d\\\\_,]+){|('.$types.')\s+([\sa-z\d\\\\_,]+){/ix', $code, $result, PREG_PATTERN_ORDER);
153 153
 
154
-        if(isset($result[0][0])) {
154
+        if (isset($result[0][0])) {
155 155
             return $result;
156 156
         }
157 157
 
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
         $result = array();
164 164
         preg_match_all('/namespace\s+([^;]+);/ix', $code, $result, PREG_PATTERN_ORDER);
165 165
 
166
-        if(isset($result[0][0])) {
166
+        if (isset($result[0][0])) {
167 167
             $this->namespace = trim($result[1][0]);
168 168
         }
169 169
     }
170 170
 
171 171
     private function parseResult(string $keyword, string $declaration, string $type, string $simpleType, string $simpleDeclaration) : void
172 172
     {
173
-        if(empty($keyword)) {
173
+        if (empty($keyword)) {
174 174
             $type = $simpleType;
175 175
             $declaration = $simpleDeclaration;
176 176
         }
Please login to merge, or discard this patch.
src/ClassHelper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      *                         the vendor name, for example (Vendor\PackageName\Folder\Class).
41 41
      * @return string|null The detected class name, or NULL otherwise.
42 42
      */
43
-    public static function resolveClassName(string $legacyName, string $nsPrefix='') : ?string
43
+    public static function resolveClassName(string $legacyName, string $nsPrefix = '') : ?string
44 44
     {
45 45
         $names = array(
46 46
             str_replace('\\', '_', $legacyName),
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             $nsPrefix.'\\'.str_replace('_', '\\', $legacyName)
49 49
         );
50 50
 
51
-        foreach($names as $name) {
51
+        foreach ($names as $name) {
52 52
             if (class_exists($name)) {
53 53
                 return ltrim($name, '\\');
54 54
             }
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
      * @return string
68 68
      * @throws ClassNotExistsException
69 69
      */
70
-    public static function requireResolvedClass(string $legacyName, string $nsPrefix='') : string
70
+    public static function requireResolvedClass(string $legacyName, string $nsPrefix = '') : string
71 71
     {
72 72
         $class = self::resolveClassName($legacyName, $nsPrefix);
73 73
 
74
-        if($class !== null)
74
+        if ($class !== null)
75 75
         {
76 76
             return $class;
77 77
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public static function requireClassExists(string $className) : void
93 93
     {
94
-        if(class_exists($className))
94
+        if (class_exists($className))
95 95
         {
96 96
             return;
97 97
         }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         self::requireClassExists($targetClass);
117 117
         self::requireClassExists($extendsClass);
118 118
 
119
-        if(is_a($targetClass, $extendsClass, true))
119
+        if (is_a($targetClass, $extendsClass, true))
120 120
         {
121 121
             return;
122 122
         }
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
      * @throws ClassNotImplementsException
143 143
      * @throws Throwable
144 144
      */
145
-    public static function requireObjectInstanceOf(string $class, object $object, int $errorCode=0)
145
+    public static function requireObjectInstanceOf(string $class, object $object, int $errorCode = 0)
146 146
     {
147
-        if($object instanceof Throwable)
147
+        if ($object instanceof Throwable)
148 148
         {
149 149
             throw $object;
150 150
         }
151 151
 
152
-        if(!class_exists($class) && !interface_exists($class) && !trait_exists($class))
152
+        if (!class_exists($class) && !interface_exists($class) && !trait_exists($class))
153 153
         {
154 154
             throw new ClassNotExistsException($class, $errorCode);
155 155
         }
156 156
 
157
-        if(is_a($object, $class, true))
157
+        if (is_a($object, $class, true))
158 158
         {
159 159
             return $object;
160 160
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public static function getClassLoader() : ClassLoader
177 177
     {
178
-        if(isset(self::$classLoader)) {
178
+        if (isset(self::$classLoader)) {
179 179
             return self::$classLoader;
180 180
         }
181 181
 
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 
190 190
         $autoloadFile = null;
191 191
 
192
-        foreach($paths as $path)
192
+        foreach ($paths as $path)
193 193
         {
194
-            if(file_exists($path)) {
194
+            if (file_exists($path)) {
195 195
                 $autoloadFile = $path;
196 196
             }
197 197
         }
198 198
 
199
-        if($autoloadFile === null) {
199
+        if ($autoloadFile === null) {
200 200
             throw new ClassLoaderNotFoundException($paths);
201 201
         }
202 202
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     private static function splitClass($subject) : array
249 249
     {
250
-        if(is_object($subject)) {
250
+        if (is_object($subject)) {
251 251
             $class = get_class($subject);
252 252
         } else {
253 253
             $class = $subject;
Please login to merge, or discard this patch.
src/Value/Bool.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 {
22 22
     protected bool $value = false;
23 23
     
24
-    public function __construct(bool $value=false)
24
+    public function __construct(bool $value = false)
25 25
     {
26 26
         $this->value = $value;
27 27
     }
Please login to merge, or discard this patch.
src/StyleCollection/StyleBuilder/Flavors/Font/FontFamily.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
     private function addFont(string $name) : FontFamily
34 34
     {
35
-        if(!in_array($name, $this->fonts, true))
35
+        if (!in_array($name, $this->fonts, true))
36 36
         {
37 37
             $this->fonts[] = $name;
38 38
         }
Please login to merge, or discard this patch.
src/Request/AcceptHeaders.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -33,22 +33,22 @@  discard block
 block discarded – undo
33 33
         $this->parse();
34 34
     }
35 35
     
36
-   /**
37
-    * Retrieves an indexed array with accept mime types
38
-    * that the client sent, in the order of preference
39
-    * the client specified.
40
-    *
41
-    * Example:
42
-    *
43
-    * array(
44
-    *     'text/html',
45
-    *     'application/xhtml+xml',
46
-    *     'image/webp'
47
-    *     ...
48
-    * )
49
-    *
50
-    * @return string[]
51
-    */
36
+    /**
37
+     * Retrieves an indexed array with accept mime types
38
+     * that the client sent, in the order of preference
39
+     * the client specified.
40
+     *
41
+     * Example:
42
+     *
43
+     * array(
44
+     *     'text/html',
45
+     *     'application/xhtml+xml',
46
+     *     'image/webp'
47
+     *     ...
48
+     * )
49
+     *
50
+     * @return string[]
51
+     */
52 52
     public function getMimeStrings() : array
53 53
     {
54 54
         $result = array();
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
         return $result;
62 62
     }
63 63
     
64
-   /**
65
-    * Checks that an "Accept" header string exists, and tries to parse it.
66
-    */
64
+    /**
65
+     * Checks that an "Accept" header string exists, and tries to parse it.
66
+     */
67 67
     protected function parse() : void
68 68
     {
69 69
         // we may be in a CLI environment where the headers
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
         $this->headers = $this->parseHeader($_SERVER['HTTP_ACCEPT']);
76 76
     }
77 77
     
78
-   /**
79
-    * Splits the "Accept" header string and parses the mime types.
80
-    *  
81
-    * @param string $acceptHeader
82
-    * @return AcceptHeader[]
83
-    */
78
+    /**
79
+     * Splits the "Accept" header string and parses the mime types.
80
+     *  
81
+     * @param string $acceptHeader
82
+     * @return AcceptHeader[]
83
+     */
84 84
     protected function parseHeader(string $acceptHeader) : array
85 85
     {
86 86
         $tokens = preg_split('/\s*,\s*/', $acceptHeader);
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
         return $accept;
98 98
     }
99 99
     
100
-   /**
101
-    * Parses a single mime type entry.
102
-    * 
103
-    * @param int $i The position in the "Accept" string
104
-    * @param string $mime The mime type
105
-    * @return AcceptHeader
106
-    */
100
+    /**
101
+     * Parses a single mime type entry.
102
+     * 
103
+     * @param int $i The position in the "Accept" string
104
+     * @param string $mime The mime type
105
+     * @return AcceptHeader
106
+     */
107 107
     protected function parseEntry(int $i, string $mime) : AcceptHeader
108 108
     {
109 109
         $quality = 0;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $result = array();
55 55
         
56
-        foreach($this->headers as $header)
56
+        foreach ($this->headers as $header)
57 57
         {
58 58
             $result[] = $header->getMimeType();
59 59
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         // we may be in a CLI environment where the headers
70 70
         // are not populated.
71
-        if(!isset($_SERVER['HTTP_ACCEPT'])) {
71
+        if (!isset($_SERVER['HTTP_ACCEPT'])) {
72 72
             return;
73 73
         }
74 74
         
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         
88 88
         $accept = array();
89 89
         
90
-        foreach($tokens as $i => $term)
90
+        foreach ($tokens as $i => $term)
91 91
         {
92 92
             $accept[] = $this->parseEntry($i, $term);
93 93
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $quality = 0;
110 110
         $params = array();
111 111
         
112
-        if(strpos($mime, ';') !== false)
112
+        if (strpos($mime, ';') !== false)
113 113
         {
114 114
             $parts = explode(';', $mime);
115 115
             $mime = (string)array_shift($parts);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             // like a URL query string if separated by ampersands;
119 119
             $params = ConvertHelper::parseQueryString(implode('&', $parts));
120 120
                 
121
-            if(isset($params['q']))
121
+            if (isset($params['q']))
122 122
             {
123 123
                 $quality = (double)$params['q'];
124 124
             } 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -148,14 +148,12 @@
 block discarded – undo
148 148
         if ($diff > 0) 
149 149
         {
150 150
             $diff = 1;
151
-        } 
152
-        else
151
+        } else
153 152
         {
154 153
             if ($diff < 0)
155 154
             {
156 155
                 $diff = -1;
157
-            }
158
-            else
156
+            } else
159 157
             {
160 158
                 /* tie-breaker: first listed item wins */
161 159
                 $diff = $a->getPosition() - $b->getPosition();
Please login to merge, or discard this patch.
src/Request/AcceptHeader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
      */
92 92
     public function offsetSet($offset, $value) : void
93 93
     {
94
-        if(isset($this->data[$offset]) && gettype($this->data[$offset]) === gettype($value)) {
94
+        if (isset($this->data[$offset]) && gettype($this->data[$offset]) === gettype($value)) {
95 95
             $this->data[$offset] = $value;
96 96
         }
97 97
     }
Please login to merge, or discard this patch.
src/FileHelper/FolderInfo.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $pathString = AbstractPathInfo::type2string($path);
32 32
 
33
-        if(!isset(self::$infoCache[$pathString]))
33
+        if (!isset(self::$infoCache[$pathString]))
34 34
         {
35 35
             self::$infoCache[$pathString] = new FolderInfo($pathString);
36 36
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         parent::__construct($path);
61 61
 
62
-        if(!self::is_dir($this->path))
62
+        if (!self::is_dir($this->path))
63 63
         {
64 64
             throw new FileHelper_Exception(
65 65
                 'Not a folder',
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $path = trim($path);
83 83
 
84
-        if($path === '' || $path === '.' || $path === '..')
84
+        if ($path === '' || $path === '.' || $path === '..')
85 85
         {
86 86
             return false;
87 87
         }
88 88
 
89
-        if(is_dir($path))
89
+        if (is_dir($path))
90 90
         {
91 91
             return true;
92 92
         }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function delete() : FolderInfo
106 106
     {
107
-        if(!$this->exists())
107
+        if (!$this->exists())
108 108
         {
109 109
             return $this;
110 110
         }
111 111
 
112
-        if(rmdir($this->path))
112
+        if (rmdir($this->path))
113 113
         {
114 114
             return $this;
115 115
         }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function create() : FolderInfo
137 137
     {
138
-        if(is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
138
+        if (is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
139 139
         {
140 140
             return $this;
141 141
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         return FileHelper::createFolder($this->getPath().'/'.$name);
186 186
     }
187 187
 
188
-    public function saveFile(string $fileName, string $content='') : FileInfo
188
+    public function saveFile(string $fileName, string $content = '') : FileInfo
189 189
     {
190 190
         return FileHelper::saveFile($this.'/'.$fileName, $content);
191 191
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @return JSONFile
198 198
      * @throws FileHelper_Exception
199 199
      */
200
-    public function saveJSONFile(array $data, string $fileName, bool $pretty=false) : JSONFile
200
+    public function saveJSONFile(array $data, string $fileName, bool $pretty = false) : JSONFile
201 201
     {
202 202
         return FileHelper::saveAsJSON($data, $this.'/'.$fileName, $pretty);
203 203
     }
Please login to merge, or discard this patch.