public function toAbsolute(\Coast\Path $base)
    {
        if (!$this->isRelative() || !$base->isAbsolute()) {
            throw new \Exception("Path '{$this}' is not relative or base path '{$base}' is not absolute");
        }

        $source = explode('/', (string) $base);
        $target = explode('/', $this->_name);
        
        $name = $source;
        array_pop($name);
        foreach ($target as $part) {
            if ($part == '..') {
                array_pop($name);
            } else if ($part != '.' && $part != '') {
                $name[] = $part;
            }
        }
        $name = implode('/', $name);

        $class = get_class($this);
        return new $class($name);
    }
public function toAbsolute(\Coast\Path $base)
    {
        if (!$this->isRelative() || !$base->isAbsolute()) {
            throw new \Exception("Path '{$this}' is not relative or base path '{$base}' is not absolute");
        }

        $source = explode('/', (string) $base);
        $target = explode('/', $this->_name);
        
        $name = $source;
        array_pop($name);
        foreach ($target as $part) {
            if ($part == '..') {
                array_pop($name);
            } else if ($part != '.' && $part != '') {
                $name[] = $part;
            }
        }
        $name = implode('/', $name);

        $class = get_class($this);
        return new $class($name);
    }
public function toAbsolute ( \ Coast \ Path $ base ) { if ( ! $ this -> isRelative ( ) || ! $ base -> isAbsolute ( ) ) { throw new \ Exception ( "Path '{$this}' is not relative or base path '{$base}' is not absolute" ) ; } $ source = explode ( '/' , ( string ) $ base ) ; $ target = explode ( '/' , $ this -> _name ) ; $ name = $ source ; array_pop ( $ name ) ; foreach ( $ target as $ part ) { if ( $ part == '..' ) { array_pop ( $ name ) ; } else if ( $ part != '.' && $ part != '' ) { $ name [ ] = $ part ; } } $ name = implode ( '/' , $ name ) ; $ class = get_class ( $ this ) ; return new $ class ( $ name ) ; }
Get absolute path from relative path.
@param  Coast\Path $base base absolute path.
@return Coast\Path
Get absolute path from relative path .