Passed
Push — master ( f15a7f...39a5d6 )
by Sebastian
03:19
created
src/FileHelper/FileInfo.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public static function factory($path) : FileInfo
52 52
     {
53
-        if($path instanceof self) {
53
+        if ($path instanceof self) {
54 54
             return $path;
55 55
         }
56 56
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         $pathString = AbstractPathInfo::type2string($path);
68 68
         $key = $pathString.';'.static::class;
69 69
 
70
-        if(!isset(self::$infoCache[$key]))
70
+        if (!isset(self::$infoCache[$key]))
71 71
         {
72 72
             $class = static::class;
73 73
             $instance = new $class($pathString);
74 74
 
75
-            if(!$instance instanceof self) {
75
+            if (!$instance instanceof self) {
76 76
                 throw new FileHelper_Exception(
77 77
                     'Invalid class'
78 78
                 );
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         parent::__construct($path);
108 108
 
109
-        if(!self::is_file($this->path))
109
+        if (!self::is_file($this->path))
110 110
         {
111 111
             throw new FileHelper_Exception(
112 112
                 'Not a file path',
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $path = trim($path);
122 122
 
123
-        if(empty($path))
123
+        if (empty($path))
124 124
         {
125 125
             return false;
126 126
         }
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
         return is_file($path) || pathinfo($path, PATHINFO_EXTENSION) !== '';
129 129
     }
130 130
 
131
-    public function removeExtension(bool $keepPath=false) : string
131
+    public function removeExtension(bool $keepPath = false) : string
132 132
     {
133
-        if(!$keepPath)
133
+        if (!$keepPath)
134 134
         {
135 135
             return (string)pathinfo($this->getName(), PATHINFO_FILENAME);
136 136
         }
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
         return $this->removeExtension();
156 156
     }
157 157
 
158
-    public function getExtension(bool $lowercase=true) : string
158
+    public function getExtension(bool $lowercase = true) : string
159 159
     {
160 160
         $ext = (string)pathinfo($this->path, PATHINFO_EXTENSION);
161 161
 
162
-        if($lowercase)
162
+        if ($lowercase)
163 163
         {
164 164
             $ext = mb_strtolower($ext);
165 165
         }
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
      */
181 181
     public function delete() : FileInfo
182 182
     {
183
-        if(!$this->exists())
183
+        if (!$this->exists())
184 184
         {
185 185
             return $this;
186 186
         }
187 187
 
188
-        if(unlink($this->path))
188
+        if (unlink($this->path))
189 189
         {
190 190
             return $this;
191 191
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     {
213 213
         $target = $this->checkCopyPrerequisites($targetPath);
214 214
 
215
-        if(copy($this->path, (string)$target))
215
+        if (copy($this->path, (string)$target))
216 216
         {
217 217
             return $target;
218 218
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function getLineReader() : LineReader
266 266
     {
267
-        if($this->lineReader === null)
267
+        if ($this->lineReader === null)
268 268
         {
269 269
             $this->lineReader = new LineReader($this);
270 270
         }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         $result = file_get_contents($this->getPath());
285 285
 
286
-        if($result !== false) {
286
+        if ($result !== false) {
287 287
             return $result;
288 288
         }
289 289
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function putContents(string $content) : FileInfo
307 307
     {
308
-        if($this->exists())
308
+        if ($this->exists())
309 309
         {
310 310
             $this->requireWritable();
311 311
         }
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 ->requireWritable();
317 317
         }
318 318
 
319
-        if(file_put_contents($this->path, $content) !== false)
319
+        if (file_put_contents($this->path, $content) !== false)
320 320
         {
321 321
             return $this;
322 322
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     private function createFolder() : FileInfo
348 348
     {
349
-        if(!$this->exists())
349
+        if (!$this->exists())
350 350
         {
351 351
             FolderInfo::factory($this->getFolderPath())
352 352
                 ->create()
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.