@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once dirname(__FILE__) . '/../vendor/autoload.php'; |
|
| 2 | +require_once dirname(__FILE__).'/../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | use NeedleProject\FileIo\File; |
| 5 | 5 | use NeedleProject\FileIo\Content\Content; |
| 6 | 6 | |
| 7 | -$filename = __DIR__ . DIRECTORY_SEPARATOR . 'my_first_file'; |
|
| 7 | +$filename = __DIR__.DIRECTORY_SEPARATOR.'my_first_file'; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Writing content to a file |
| 11 | 11 | */ |
| 12 | 12 | $content = new Content('Hello world!'); |
| 13 | -$file = new File(__DIR__ . DIRECTORY_SEPARATOR . 'my_first_file'); |
|
| 13 | +$file = new File(__DIR__.DIRECTORY_SEPARATOR.'my_first_file'); |
|
| 14 | 14 | if (true === $file->write($content)) { |
| 15 | 15 | echo "I wrote my first file!\n"; |
| 16 | 16 | } |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | * Verifying file |
| 20 | 20 | */ |
| 21 | 21 | if (true === $file->exists()) { |
| 22 | - echo sprintf('File %s exists on disk!', $filename) . "\n"; |
|
| 22 | + echo sprintf('File %s exists on disk!', $filename)."\n"; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if (true === $file->isWritable()) { |
| 26 | - echo sprintf('File %s can be written!', $filename) . "\n"; |
|
| 26 | + echo sprintf('File %s can be written!', $filename)."\n"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if (true === $file->isReadable()) { |
| 30 | - echo sprintf('File %s can be read!', $filename) . "\n"; |
|
| 30 | + echo sprintf('File %s can be read!', $filename)."\n"; |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -41,5 +41,5 @@ discard block |
||
| 41 | 41 | * Delete the file |
| 42 | 42 | */ |
| 43 | 43 | if (true === $file->delete()) { |
| 44 | - echo "The file was successfully deleted!" . "\n"; |
|
| 44 | + echo "The file was successfully deleted!"."\n"; |
|
| 45 | 45 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function normalizePathSeparator(string $path): string |
| 34 | 34 | { |
| 35 | 35 | $path = preg_replace('#(\\\|\/)#', DIRECTORY_SEPARATOR, $path); |
| 36 | - return preg_replace('#' . DIRECTORY_SEPARATOR . '{2,}#', DIRECTORY_SEPARATOR, $path); |
|
| 36 | + return preg_replace('#'.DIRECTORY_SEPARATOR.'{2,}#', DIRECTORY_SEPARATOR, $path); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -57,6 +57,6 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | public function getObject() |
| 59 | 59 | { |
| 60 | - return (object)['content' => $this->content]; |
|
| 60 | + return (object) ['content' => $this->content]; |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -44,6 +44,6 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function getObject() |
| 46 | 46 | { |
| 47 | - return (object)$this->getArray(); |
|
| 47 | + return (object) $this->getArray(); |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | ); |
| 82 | 82 | } |
| 83 | 83 | list($this->name, $this->extension) = $pathHelper->splitFilename($filename); |
| 84 | - $this->hasExtension = (bool)$this->extension; |
|
| 84 | + $this->hasExtension = (bool) $this->extension; |
|
| 85 | 85 | $this->errorHandler = new ErrorToExceptionConverter(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | if ($this->isWritable() === false) { |
| 187 | 187 | throw new PermissionDeniedException("The current file is not writable!"); |
| 188 | 188 | } |
| 189 | - file_put_contents($this->filenameWithPath, $content . $this->getContent()->get()); |
|
| 189 | + file_put_contents($this->filenameWithPath, $content.$this->getContent()->get()); |
|
| 190 | 190 | return $this; |
| 191 | 191 | } |
| 192 | 192 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | if (false === $this->hasExtension()) { |
| 243 | 243 | return $this->name; |
| 244 | 244 | } |
| 245 | - return $this->name . static::EXTENSION_SEPARATOR . $this->extension; |
|
| 245 | + return $this->name.static::EXTENSION_SEPARATOR.$this->extension; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |