We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 471b7d8 commit ddf04d0Copy full SHA for ddf04d0
src/Url.php
@@ -221,13 +221,20 @@ public function withDirectoryPosition($key, $value)
221
{
222
$clone = clone $this;
223
224
- if ($key === count($clone->info['path'])) {
225
- $clone->info['file'] = $value;
+ $pos = $clone->info['path'];
+ $hasFile = isset($clone->info['file']);
226
227
- return $clone;
+ if ($hasFile) {
228
+ $pos[] = $clone->info['file'];
229
}
230
- $clone->info['path'][$key] = $value;
231
+ $pos[$key] = $value;
232
+
233
234
+ $clone->info['file'] = array_pop($pos);
235
+ }
236
237
+ $clone->info['path'] = $pos;
238
239
return $clone;
240
0 commit comments