@@ -50,7 +50,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | return implode('/', $parts); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - public function getExtension(bool $lowercase=true) : string |
|
| 147 | + public function getExtension(bool $lowercase = true) : string |
|
| 148 | 148 | { |
| 149 | 149 | $ext = (string)pathinfo($this->path, PATHINFO_EXTENSION); |
| 150 | 150 | |
| 151 | - if($lowercase) |
|
| 151 | + if ($lowercase) |
|
| 152 | 152 | { |
| 153 | 153 | $ext = mb_strtolower($ext); |
| 154 | 154 | } |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function delete() : FileInfo |
| 171 | 171 | { |
| 172 | - if(!$this->exists()) |
|
| 172 | + if (!$this->exists()) |
|
| 173 | 173 | { |
| 174 | 174 | return $this; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if(unlink($this->path)) |
|
| 177 | + if (unlink($this->path)) |
|
| 178 | 178 | { |
| 179 | 179 | return $this; |
| 180 | 180 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $target = $this->checkCopyPrerequisites($targetPath); |
| 203 | 203 | |
| 204 | - if(copy($this->path, (string)$target)) |
|
| 204 | + if (copy($this->path, (string)$target)) |
|
| 205 | 205 | { |
| 206 | 206 | return $target; |
| 207 | 207 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function getLineReader() : LineReader |
| 255 | 255 | { |
| 256 | - if($this->lineReader === null) |
|
| 256 | + if ($this->lineReader === null) |
|
| 257 | 257 | { |
| 258 | 258 | $this->lineReader = new LineReader($this); |
| 259 | 259 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $result = file_get_contents($this->getPath()); |
| 274 | 274 | |
| 275 | - if($result !== false) { |
|
| 275 | + if ($result !== false) { |
|
| 276 | 276 | return $result; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function putContents(string $content) : FileInfo |
| 296 | 296 | { |
| 297 | - if($this->exists()) |
|
| 297 | + if ($this->exists()) |
|
| 298 | 298 | { |
| 299 | 299 | $this->requireWritable(); |
| 300 | 300 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | ->requireWritable(); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if(file_put_contents($this->path, $content) !== false) |
|
| 308 | + if (file_put_contents($this->path, $content) !== false) |
|
| 309 | 309 | { |
| 310 | 310 | return $this; |
| 311 | 311 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | private function createFolder() : FileInfo |
| 337 | 337 | { |
| 338 | - if(!$this->exists()) |
|
| 338 | + if (!$this->exists()) |
|
| 339 | 339 | { |
| 340 | 340 | FolderInfo::factory($this->getFolderPath()) |
| 341 | 341 | ->create() |