@@ -80,9 +80,9 @@ |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | - public function getMIMEType($fast=true): string |
|
83 | + public function getMIMEType($fast = true): string |
|
84 | 84 | { |
85 | - if($fast === true || extension_loaded('fileinfo') === false){ |
|
85 | + if ($fast === true || extension_loaded('fileinfo') === false) { |
|
86 | 86 | return mime_content_type($this->path()); |
87 | 87 | } |
88 | 88 |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | $absolutePath = $this->absolutePathFor($relativePath); |
98 | 98 | |
99 | 99 | // Filter the list of files to include only files (not directories). |
100 | - $files = array_filter($this->list($relativePath), function ($filename) use ($absolutePath) { |
|
101 | - return is_file($absolutePath . DIRECTORY_SEPARATOR . $filename); |
|
100 | + $files = array_filter($this->list($relativePath), function($filename) use ($absolutePath) { |
|
101 | + return is_file($absolutePath.DIRECTORY_SEPARATOR.$filename); |
|
102 | 102 | }); |
103 | 103 | |
104 | 104 | return $files; |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | $absolutePath = $this->absolutePathFor($relativePath); |
116 | 116 | |
117 | 117 | // Filter the list of files to include only files (not directories). |
118 | - $files = array_filter($this->list($relativePath), function ($filename) use ($absolutePath) { |
|
119 | - return is_dir($absolutePath . DIRECTORY_SEPARATOR . $filename); |
|
118 | + $files = array_filter($this->list($relativePath), function($filename) use ($absolutePath) { |
|
119 | + return is_dir($absolutePath.DIRECTORY_SEPARATOR.$filename); |
|
120 | 120 | }); |
121 | 121 | |
122 | 122 | return $files; |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | * @return bool True if the path is writable, false otherwise. |
131 | 131 | */ |
132 | 132 | |
133 | - public function ensureWritablePath(string $absoluteDirectoryPath, string $filename=null): bool |
|
133 | + public function ensureWritablePath(string $absoluteDirectoryPath, string $filename = null): bool |
|
134 | 134 | { |
135 | 135 | if (strpos($absoluteDirectoryPath, $this->root()) !== 0) { |
136 | 136 | throw new \InvalidArgumentException('PATH_NOT_INSIDE_ROOT_PATH'); |
137 | 137 | } |
138 | 138 | |
139 | - $relativeDirectoryPath = substr($absoluteDirectoryPath, strlen($this->root()) + 1); |
|
139 | + $relativeDirectoryPath = substr($absoluteDirectoryPath, strlen($this->root())+1); |
|
140 | 140 | $pathParts = explode('/', $relativeDirectoryPath); |
141 | 141 | |
142 | 142 | |
143 | 143 | $targetDir = $this->root(); |
144 | 144 | foreach ($pathParts as $i => $part) { |
145 | - $targetDir .= '/' . $part; |
|
145 | + $targetDir .= '/'.$part; |
|
146 | 146 | |
147 | 147 | // Create the folder if it doesn't exist |
148 | 148 | if (!file_exists($targetDir) && mkdir($targetDir, 0755, true) === false) { |
@@ -27,8 +27,9 @@ |
||
27 | 27 | function __construct(string $rootPath) |
28 | 28 | { |
29 | 29 | $rootPath = realpath($rootPath); |
30 | - if (!$rootPath) |
|
31 | - throw new \InvalidArgumentException('INVALID_ROOT_PATH'); |
|
30 | + if (!$rootPath) { |
|
31 | + throw new \InvalidArgumentException('INVALID_ROOT_PATH'); |
|
32 | + } |
|
32 | 33 | |
33 | 34 | $this->rootPath = $rootPath; |
34 | 35 | } |