public function Url::addPath

Add a relative path to the currently set path

Parameters

string $relativePath Relative path to add:

Return value

Url

1 call to Url::addPath()
Url::combine in drupal/core/vendor/guzzle/http/Guzzle/Http/Url.php
Combine the URL with another URL. Parts specified in the passed URL will supersede parts in the current URL.

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Url.php, line 337

Class

Url
Parses and generates URLs based on URL parts. In favor of performance, URL parts are not validated.

Namespace

Guzzle\Http

Code

public function addPath($relativePath) {
  if (!$relativePath || $relativePath == '/') {
    return $this;
  }

  // Add a leading slash if needed
  if ($relativePath[0] != '/') {
    $relativePath = '/' . $relativePath;
  }
  return $this
    ->setPath(str_replace('//', '/', $this
    ->getPath() . $relativePath));
}