|
@@ -94,8 +94,8 @@ discard block |
|
|
block discarded – undo |
|
94
|
94
|
{ |
|
95
|
95
|
$absolutePath = $this->absolutePathFor($relativePath); |
|
96
|
96
|
// Filter the list of files to include only files (not directories). |
|
97
|
|
- $files = array_filter($this->list($relativePath), function ($filename) use ($absolutePath) { |
|
98
|
|
- return is_file($absolutePath . DIRECTORY_SEPARATOR . $filename); |
|
|
97
|
+ $files = array_filter($this->list($relativePath), function($filename) use ($absolutePath) { |
|
|
98
|
+ return is_file($absolutePath.DIRECTORY_SEPARATOR.$filename); |
|
99
|
99
|
}); |
|
100
|
100
|
|
|
101
|
101
|
return $files; |
|
@@ -112,8 +112,8 @@ discard block |
|
|
block discarded – undo |
|
112
|
112
|
$absolutePath = $this->absolutePathFor($relativePath); |
|
113
|
113
|
|
|
114
|
114
|
// Filter the list of files to include only files (not directories). |
|
115
|
|
- $files = array_filter($this->list($relativePath), function ($filename) use ($absolutePath) { |
|
116
|
|
- return is_dir($absolutePath . DIRECTORY_SEPARATOR . $filename); |
|
|
115
|
+ $files = array_filter($this->list($relativePath), function($filename) use ($absolutePath) { |
|
|
116
|
+ return is_dir($absolutePath.DIRECTORY_SEPARATOR.$filename); |
|
117
|
117
|
}); |
|
118
|
118
|
|
|
119
|
119
|
return $files; |
|
@@ -127,19 +127,19 @@ discard block |
|
|
block discarded – undo |
|
127
|
127
|
* @return bool True if the path is writable, false otherwise. |
|
128
|
128
|
*/ |
|
129
|
129
|
|
|
130
|
|
- public function ensureWritablePath(string $absoluteDirectoryPath, string $filename=null): bool |
|
|
130
|
+ public function ensureWritablePath(string $absoluteDirectoryPath, string $filename = null): bool |
|
131
|
131
|
{ |
|
132
|
132
|
if (strpos($absoluteDirectoryPath, $this->root()) !== 0) { |
|
133
|
133
|
throw new \InvalidArgumentException('PATH_NOT_INSIDE_ROOT_PATH'); |
|
134
|
134
|
} |
|
135
|
135
|
|
|
136
|
|
- $relativeDirectoryPath = substr($absoluteDirectoryPath, strlen($this->root()) + 1); |
|
|
136
|
+ $relativeDirectoryPath = substr($absoluteDirectoryPath, strlen($this->root())+1); |
|
137
|
137
|
$pathParts = explode('/', $relativeDirectoryPath); |
|
138
|
138
|
|
|
139
|
139
|
|
|
140
|
140
|
$targetDir = $this->root(); |
|
141
|
141
|
foreach ($pathParts as $i => $part) { |
|
142
|
|
- $targetDir .= '/' . $part; |
|
|
142
|
+ $targetDir .= '/'.$part; |
|
143
|
143
|
|
|
144
|
144
|
// Create the folder if it doesn't exist |
|
145
|
145
|
if (!file_exists($targetDir) && mkdir($targetDir, 0755, true) === false) { |