Example #1
0
 /**
  * Format the Path in a URL string
  *
  * @param  Path $path
  * @param  boolean    $has_authority_part does the URL as an authority part
  *
  * @return string
  */
 protected function formatPath(Path $path, $has_authority_part = false)
 {
     $str = $path->getUriComponent();
     if (!$has_authority_part) {
         return preg_replace(',^/+,', '/', $str);
     }
     if (!$path->isEmpty() && !$path->isAbsolute()) {
         return '/' . $str;
     }
     return $str;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function withExtension($extension)
 {
     return $this->withProperty('path', $this->path->withExtension($extension));
 }