public function withDirectoryPosition($key, $value)
    {
        $clone = clone $this;

        $pos = $clone->info['path'];
        $hasFile = isset($clone->info['file']);

        if ($hasFile) {
            $pos[] = $clone->info['file'];
        }

        $pos[$key] = $value;

        if ($hasFile) {
            $clone->info['file'] = array_pop($pos);
        }

        $clone->info['path'] = $pos;

        return $clone;
    }
public function withDirectoryPosition($key, $value)
    {
        $clone = clone $this;

        $pos = $clone->info['path'];
        $hasFile = isset($clone->info['file']);

        if ($hasFile) {
            $pos[] = $clone->info['file'];
        }

        $pos[$key] = $value;

        if ($hasFile) {
            $clone->info['file'] = array_pop($pos);
        }

        $clone->info['path'] = $pos;

        return $clone;
    }
public function withDirectoryPosition ( $ key , $ value ) { $ clone = clone $ this ; $ pos = $ clone -> info [ 'path' ] ; $ hasFile = isset ( $ clone -> info [ 'file' ] ) ; if ( $ hasFile ) { $ pos [ ] = $ clone -> info [ 'file' ] ; } $ pos [ $ key ] = $ value ; if ( $ hasFile ) { $ clone -> info [ 'file' ] = array_pop ( $ pos ) ; } $ clone -> info [ 'path' ] = $ pos ; return $ clone ; }
Returns a clone with other directory in a specific position.

@param int|null $key   The position of the subdirectory (0 based index)
@param string   $value The new value

@return Url
Returns a clone with other directory in a specific position .