public function evaluate()
    {
        $postPath = array();
        $prePath = array();

        $path = rtrim($this->path, '/');
        $pathSegments = explode('/', $path);
        foreach ($pathSegments as $segment) {
            if ($segment == '..') {
                if (count($postPath) > 0) {
                    array_pop($postPath);
                } else {
                    // we've gone past the start of the relative path
                    array_push($prePath, '..');
                }
            } else if ($segment == '.') {
                // no-op
            } else {
                array_push($postPath, $segment);
            }
        }

        return new Concentrate_Path(
            implode(
                '/',
                array_merge(
                    $prePath,
                    $postPath
                )
            )
        );
    }
public function evaluate()
    {
        $postPath = array();
        $prePath = array();

        $path = rtrim($this->path, '/');
        $pathSegments = explode('/', $path);
        foreach ($pathSegments as $segment) {
            if ($segment == '..') {
                if (count($postPath) > 0) {
                    array_pop($postPath);
                } else {
                    // we've gone past the start of the relative path
                    array_push($prePath, '..');
                }
            } else if ($segment == '.') {
                // no-op
            } else {
                array_push($postPath, $segment);
            }
        }

        return new Concentrate_Path(
            implode(
                '/',
                array_merge(
                    $prePath,
                    $postPath
                )
            )
        );
    }
public function evaluate ( ) { $ postPath = array ( ) ; $ prePath = array ( ) ; $ path = rtrim ( $ this -> path , '/' ) ; $ pathSegments = explode ( '/' , $ path ) ; foreach ( $ pathSegments as $ segment ) { if ( $ segment == '..' ) { if ( count ( $ postPath ) > 0 ) { array_pop ( $ postPath ) ; } else { // we've gone past the start of the relative path array_push ( $ prePath , '..' ) ; } } else if ( $ segment == '.' ) { // no-op } else { array_push ( $ postPath , $ segment ) ; } } return new Concentrate_Path ( implode ( '/' , array_merge ( $ prePath , $ postPath ) ) ) ; }
Evaluates a path that contains relative references and removes
superfluous current directory references

@return Concentrate_Path a new path object.
Evaluates a path that contains relative references and removes superfluous current directory references