Passed
Branch develop (38d99c)
by nguereza
21:45
created
src/Filesystem.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * Class Filesystem
55 55
  * @package Platine\Filesystem
56 56
  */
57
-class Filesystem
58
-{
57
+class Filesystem {
59 58
 
60 59
     /**
61 60
      * The adapter instance
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
      * Create new instance
68 67
      * @param AdapterInterface|null $adapter
69 68
      */
70
-    public function __construct(?AdapterInterface $adapter = null)
71
-    {
69
+    public function __construct(?AdapterInterface $adapter = null) {
72 70
         $this->adapter = $adapter ? $adapter : new LocalAdapter();
73 71
     }
74 72
 
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      * @param string $path
87 85
      * @return FileInterface|DirectoryInterface|null
88 86
      */
89
-    public function get(string $path)
90
-    {
87
+    public function get(string $path) {
91 88
         return $this->adapter->get($path);
92 89
     }
93 90
 
Please login to merge, or discard this patch.
src/Util/Helper.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
  * Class Helper
52 52
  * @package Platine\Filesystem\Util
53 53
  */
54
-class Helper
55
-{
54
+class Helper {
56 55
 
57 56
     /**
58 57
      * List of mime type
Please login to merge, or discard this patch.
src/FileInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
  * Class FileInterface
52 52
  * @package Platine\Filesystem
53 53
  */
54
-interface FileInterface extends FileSystemInterface
55
-{
54
+interface FileInterface extends FileSystemInterface {
56 55
 
57 56
     /**
58 57
      * Create new file
Please login to merge, or discard this patch.
src/DirectoryInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
  * Class DirectoryInterface
52 52
  * @package Platine\Filesystem
53 53
  */
54
-interface DirectoryInterface extends FileSystemInterface
55
-{
54
+interface DirectoryInterface extends FileSystemInterface {
56 55
 
57 56
     /**
58 57
      * Filter list for directory read
Please login to merge, or discard this patch.
src/Adapter/Local/File.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 {
59 59
 
60 60
     /**
61
-    * {@inheritdoc}
62
-    */
61
+     * {@inheritdoc}
62
+     */
63 63
     public function append(string $content): self
64 64
     {
65 65
         file_put_contents($this->path, $content, FILE_APPEND);
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     /**
71
-    * {@inheritdoc}
72
-    */
71
+     * {@inheritdoc}
72
+     */
73 73
     public function copyTo($directory, int $mode = 0775)
74 74
     {
75 75
         if (is_string($directory)) {
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     }
85 85
 
86 86
     /**
87
-    * {@inheritdoc}
88
-    */
87
+     * {@inheritdoc}
88
+     */
89 89
     public function create(string $path, string $content = '', int $mode = 0775)
90 90
     {
91 91
         $file = $this->adapter->file($path)->write($content);
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     }
96 96
 
97 97
     /**
98
-    * {@inheritdoc}
99
-    */
98
+     * {@inheritdoc}
99
+     */
100 100
     public function delete(): self
101 101
     {
102 102
         unlink($this->path);
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     /**
108
-    * {@inheritdoc}
109
-    */
108
+     * {@inheritdoc}
109
+     */
110 110
     public function getExtension(): string
111 111
     {
112 112
         return pathinfo($this->path, PATHINFO_EXTENSION);
113 113
     }
114 114
 
115 115
     /**
116
-    * {@inheritdoc}
117
-    */
116
+     * {@inheritdoc}
117
+     */
118 118
     public function getMime(): string
119 119
     {
120 120
         $mime = mime_content_type($this->path);
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
     }
127 127
 
128 128
     /**
129
-    * {@inheritdoc}
130
-    */
129
+     * {@inheritdoc}
130
+     */
131 131
     public function getType(): string
132 132
     {
133 133
         return 'file';
134 134
     }
135 135
 
136 136
     /**
137
-    * {@inheritdoc}
138
-    */
137
+     * {@inheritdoc}
138
+     */
139 139
     public function read(): string
140 140
     {
141 141
         return (string) file_get_contents($this->path);
142 142
     }
143 143
 
144 144
     /**
145
-    * {@inheritdoc}
146
-    */
145
+     * {@inheritdoc}
146
+     */
147 147
     public function write(string $content): self
148 148
     {
149 149
         file_put_contents($this->path, $content);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@  discard block
 block discarded – undo
54 54
  * Class File
55 55
  * @package Platine\Filesystem\Adapter\Local
56 56
  */
57
-class File extends AbstractLocal implements FileInterface
58
-{
57
+class File extends AbstractLocal implements FileInterface {
59 58
 
60 59
     /**
61 60
     * {@inheritdoc}
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
     /**
71 70
     * {@inheritdoc}
72 71
     */
73
-    public function copyTo($directory, int $mode = 0775)
74
-    {
72
+    public function copyTo($directory, int $mode = 0775) {
75 73
         if (is_string($directory)) {
76 74
             $directory = $this->adapter->directory($directory);
77 75
         }
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
     /**
87 85
     * {@inheritdoc}
88 86
     */
89
-    public function create(string $path, string $content = '', int $mode = 0775)
90
-    {
87
+    public function create(string $path, string $content = '', int $mode = 0775) {
91 88
         $file = $this->adapter->file($path)->write($content);
92 89
         $file->chmod($mode);
93 90
 
Please login to merge, or discard this patch.
src/Adapter/Local/Directory.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 {
61 61
 
62 62
     /**
63
-    * {@inheritdoc}
64
-    */
63
+     * {@inheritdoc}
64
+     */
65 65
     public function copyTo($directory, int $mode = 0775)
66 66
     {
67 67
         if (!$this->exists()) {
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     }
96 96
 
97 97
     /**
98
-    * {@inheritdoc}
99
-    */
98
+     * {@inheritdoc}
99
+     */
100 100
     public function create(string $name, int $mode = 0775)
101 101
     {
102 102
         if (!file_exists($this->path . DIRECTORY_SEPARATOR . $name)) {
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     }
112 112
 
113 113
     /**
114
-    * {@inheritdoc}
115
-    */
114
+     * {@inheritdoc}
115
+     */
116 116
     public function createFile(
117 117
         string $name,
118 118
         string $content = '',
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
     }
128 128
 
129 129
     /**
130
-    * {@inheritdoc}
131
-    */
130
+     * {@inheritdoc}
131
+     */
132 132
     public function delete(): self
133 133
     {
134 134
         if (!$this->exists()) {
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     /**
147
-    * {@inheritdoc}
148
-    */
147
+     * {@inheritdoc}
148
+     */
149 149
     public function getType(): string
150 150
     {
151 151
         return 'dir';
152 152
     }
153 153
 
154 154
     /**
155
-    * {@inheritdoc}
156
-    */
155
+     * {@inheritdoc}
156
+     */
157 157
     public function read(int $type = self::ALL): array
158 158
     {
159 159
         $files = [
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 
182 182
         switch ($type) {
183 183
             case self::ALL;
184
-              return array_merge($files['dir'], $files['file']);
184
+                return array_merge($files['dir'], $files['file']);
185 185
             case self::FILE;
186
-              return $files['file'];
186
+                return $files['file'];
187 187
             case self::DIR;
188
-              return $files['dir'];
188
+                return $files['dir'];
189 189
             default:
190 190
                 throw new InvalidArgumentException(sprintf(
191 191
                     'Invalid filter value [%d] must be one of [%s]',
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
     }
197 197
 
198 198
     /**
199
-    * {@inheritdoc}
200
-    */
199
+     * {@inheritdoc}
200
+     */
201 201
     public function scan(): array
202 202
     {
203 203
         $list = [];
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,14 +56,12 @@  discard block
 block discarded – undo
56 56
  * Class Directory
57 57
  * @package Platine\Filesystem\Adapter\Local
58 58
  */
59
-class Directory extends AbstractLocal implements DirectoryInterface
60
-{
59
+class Directory extends AbstractLocal implements DirectoryInterface {
61 60
 
62 61
     /**
63 62
     * {@inheritdoc}
64 63
     */
65
-    public function copyTo($directory, int $mode = 0775)
66
-    {
64
+    public function copyTo($directory, int $mode = 0775) {
67 65
         if (!$this->exists()) {
68 66
             throw new NotFoundException(sprintf(
69 67
                 'Source path [%s] not found',
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
     /**
98 96
     * {@inheritdoc}
99 97
     */
100
-    public function create(string $name, int $mode = 0775)
101
-    {
98
+    public function create(string $name, int $mode = 0775) {
102 99
         if (!file_exists($this->path . DIRECTORY_SEPARATOR . $name)) {
103 100
             mkdir($this->path . DIRECTORY_SEPARATOR . $name, $mode);
104 101
         } else {
Please login to merge, or discard this patch.
src/Adapter/Local/LocalAdapter.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -95,24 +95,24 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
     /**
98
-    * {@inheritdoc}
99
-    */
98
+     * {@inheritdoc}
99
+     */
100 100
     public function directory(string $path = ''): DirectoryInterface
101 101
     {
102 102
         return new Directory($path, $this);
103 103
     }
104 104
 
105 105
     /**
106
-    * {@inheritdoc}
107
-    */
106
+     * {@inheritdoc}
107
+     */
108 108
     public function file(string $path = ''): FileInterface
109 109
     {
110 110
         return new File($path, $this);
111 111
     }
112 112
 
113 113
     /**
114
-    * {@inheritdoc}
115
-    */
114
+     * {@inheritdoc}
115
+     */
116 116
     public function get(string $path)
117 117
     {
118 118
         $absolutePath = $this->getAbsolutePath($path);
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
     }
130 130
 
131 131
     /**
132
-    * {@inheritdoc}
133
-    */
132
+     * {@inheritdoc}
133
+     */
134 134
     public function getAbsolutePath(string $path): string
135 135
     {
136 136
         $normalizedPath = Helper::normalizePath($path);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,7 @@  discard block
 block discarded – undo
57 57
  * Class LocalAdpater
58 58
  * @package Platine\Filesystem\Adapter\Local
59 59
  */
60
-class LocalAdapter implements AdapterInterface
61
-{
60
+class LocalAdapter implements AdapterInterface {
62 61
 
63 62
     /**
64 63
      * The root directory
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
      * Create new instance
71 70
      * @param string|null $root
72 71
      */
73
-    public function __construct(?string $root = null)
74
-    {
72
+    public function __construct(?string $root = null) {
75 73
         if ($root === null) {
76 74
             $path = realpath(__DIR__ . '../../../../../');
77 75
             if ($path !== false) {
@@ -113,8 +111,7 @@  discard block
 block discarded – undo
113 111
     /**
114 112
     * {@inheritdoc}
115 113
     */
116
-    public function get(string $path)
117
-    {
114
+    public function get(string $path) {
118 115
         $absolutePath = $this->getAbsolutePath($path);
119 116
 
120 117
         if (is_file($absolutePath)) {
Please login to merge, or discard this patch.
src/Adapter/Local/Exception/NotFoundException.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,6 +39,5 @@
 block discarded – undo
39 39
  * Class NotFoundException
40 40
  * @package Platine\Filesystem\Adapter\Local\Exception
41 41
  */
42
-class NotFoundException extends Exception
43
-{
42
+class NotFoundException extends Exception {
44 43
 }
Please login to merge, or discard this patch.
src/Adapter/Local/AbstractLocal.php 3 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
     }
131 131
 
132 132
     /**
133
-    * {@inheritdoc}
134
-    */
133
+     * {@inheritdoc}
134
+     */
135 135
     public function moveTo($directory)
136 136
     {
137 137
         $dest = $this->copyTo($directory);
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     }
143 143
 
144 144
     /**
145
-    * {@inheritdoc}
146
-    */
145
+     * {@inheritdoc}
146
+     */
147 147
     public function chmod(int $mode)
148 148
     {
149 149
         chmod($this->path, $mode);
@@ -152,24 +152,24 @@  discard block
 block discarded – undo
152 152
     }
153 153
 
154 154
     /**
155
-    * {@inheritdoc}
156
-    */
155
+     * {@inheritdoc}
156
+     */
157 157
     public function exists(): bool
158 158
     {
159 159
         return $this->isExists($this->path);
160 160
     }
161 161
 
162 162
     /**
163
-    * {@inheritdoc}
164
-    */
163
+     * {@inheritdoc}
164
+     */
165 165
     public function getLocation(): string
166 166
     {
167 167
         return dirname($this->path);
168 168
     }
169 169
 
170 170
     /**
171
-    * {@inheritdoc}
172
-    */
171
+     * {@inheritdoc}
172
+     */
173 173
     public function getMtime(): int
174 174
     {
175 175
         $time  = filemtime($this->path);
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
     }
178 178
 
179 179
     /**
180
-    * {@inheritdoc}
181
-    */
180
+     * {@inheritdoc}
181
+     */
182 182
     public function getName(): string
183 183
     {
184 184
         return basename($this->path);
185 185
     }
186 186
 
187 187
     /**
188
-    * {@inheritdoc}
189
-    */
188
+     * {@inheritdoc}
189
+     */
190 190
     public function getPermission(): string
191 191
     {
192 192
         $permission = fileperms($this->path);
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     /**
200
-    * {@inheritdoc}
201
-    */
200
+     * {@inheritdoc}
201
+     */
202 202
     public function getSize(): int
203 203
     {
204 204
         $size = filesize($this->path);
@@ -206,40 +206,40 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-    * {@inheritdoc}
210
-    */
209
+     * {@inheritdoc}
210
+     */
211 211
     public function isDir(): bool
212 212
     {
213 213
         return $this->getType() === 'dir';
214 214
     }
215 215
 
216 216
     /**
217
-    * {@inheritdoc}
218
-    */
217
+     * {@inheritdoc}
218
+     */
219 219
     public function isFile(): bool
220 220
     {
221 221
         return $this->getType() === 'file';
222 222
     }
223 223
 
224 224
     /**
225
-    * {@inheritdoc}
226
-    */
225
+     * {@inheritdoc}
226
+     */
227 227
     public function isReadable(): bool
228 228
     {
229 229
         return is_readable($this->path);
230 230
     }
231 231
 
232 232
     /**
233
-    * {@inheritdoc}
234
-    */
233
+     * {@inheritdoc}
234
+     */
235 235
     public function isWritable(): bool
236 236
     {
237 237
         return is_writable($this->path);
238 238
     }
239 239
 
240 240
     /**
241
-    * {@inheritdoc}
242
-    */
241
+     * {@inheritdoc}
242
+     */
243 243
     public function rename(string $newPath)
244 244
     {
245 245
         $normalizedNewPath = rtrim(Helper::normalizePath($newPath), '\\/');
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
     }
259 259
 
260 260
     /**
261
-    * {@inheritdoc}
262
-    */
261
+     * {@inheritdoc}
262
+     */
263 263
     public function touch(int $time)
264 264
     {
265 265
         touch($this->path, $time);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
     */
173 173
     public function getMtime(): int
174 174
     {
175
-        $time  = filemtime($this->path);
175
+        $time = filemtime($this->path);
176 176
         return $time !== false ? $time : -1;
177 177
     }
178 178
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
  * Class AbstractLocal
56 56
  * @package Platine\Filesystem\Adapter\Local
57 57
  */
58
-abstract class AbstractLocal implements FileSystemInterface
59
-{
58
+abstract class AbstractLocal implements FileSystemInterface {
60 59
 
61 60
     /**
62 61
      * The adapter instance
@@ -81,8 +80,7 @@  discard block
 block discarded – undo
81 80
      * @param string $path
82 81
      * @param AdapterInterface $adapter
83 82
      */
84
-    public function __construct(string $path, AdapterInterface $adapter)
85
-    {
83
+    public function __construct(string $path, AdapterInterface $adapter) {
86 84
         $this->adapter = $adapter;
87 85
         $this->setPath($path);
88 86
     }
@@ -132,8 +130,7 @@  discard block
 block discarded – undo
132 130
     /**
133 131
     * {@inheritdoc}
134 132
     */
135
-    public function moveTo($directory)
136
-    {
133
+    public function moveTo($directory) {
137 134
         $dest = $this->copyTo($directory);
138 135
         $dest->touch($this->getMtime());
139 136
         $this->delete();
@@ -144,8 +141,7 @@  discard block
 block discarded – undo
144 141
     /**
145 142
     * {@inheritdoc}
146 143
     */
147
-    public function chmod(int $mode)
148
-    {
144
+    public function chmod(int $mode) {
149 145
         chmod($this->path, $mode);
150 146
 
151 147
         return $this;
@@ -240,8 +236,7 @@  discard block
 block discarded – undo
240 236
     /**
241 237
     * {@inheritdoc}
242 238
     */
243
-    public function rename(string $newPath)
244
-    {
239
+    public function rename(string $newPath) {
245 240
         $normalizedNewPath = rtrim(Helper::normalizePath($newPath), '\\/');
246 241
         if (strpos($normalizedNewPath, DIRECTORY_SEPARATOR) === false) {
247 242
             $normalizedNewPath = dirname($this->originalPath)
@@ -260,8 +255,7 @@  discard block
 block discarded – undo
260 255
     /**
261 256
     * {@inheritdoc}
262 257
     */
263
-    public function touch(int $time)
264
-    {
258
+    public function touch(int $time) {
265 259
         touch($this->path, $time);
266 260
 
267 261
         return $this;
Please login to merge, or discard this patch.