public static function real($input, $separator = self::SEPARATOR_BOTH){
        $parsed = self::parse($input, $separator);
        if(!self::validate($parsed["path"]))
            throw new \Exception("Path is invalid");

        $elements_in =  self::explode($parsed["path"], $separator);
        $elements_out = array();
        $absolute = self::isAbsolute($input);

        if(self::isAbsolute($input))
            array_push($elements_out, null);

        foreach($elements_in as $idx => $element){
            switch($element){
                case "":
                case ".":
                    break;
                case "..":
                    if(count($elements_out) > 0 && end($elements_out) != "..")
                        array_pop($elements_out);
                    elseif(!$absolute)
                        array_push($elements_out, "..");
                    else
                        throw new \Exception("Can not move to parent of root folder in an absolute path");
                    break;
                default:
                    array_push($elements_out, $element);
            }
        }

        return $parsed["device"].implode($separator==self::SEPARATOR_BOTH? self::SEPARATOR_LINUX : $separator, $elements_out);
    }
public static function real($input, $separator = self::SEPARATOR_BOTH){
        $parsed = self::parse($input, $separator);
        if(!self::validate($parsed["path"]))
            throw new \Exception("Path is invalid");

        $elements_in =  self::explode($parsed["path"], $separator);
        $elements_out = array();
        $absolute = self::isAbsolute($input);

        if(self::isAbsolute($input))
            array_push($elements_out, null);

        foreach($elements_in as $idx => $element){
            switch($element){
                case "":
                case ".":
                    break;
                case "..":
                    if(count($elements_out) > 0 && end($elements_out) != "..")
                        array_pop($elements_out);
                    elseif(!$absolute)
                        array_push($elements_out, "..");
                    else
                        throw new \Exception("Can not move to parent of root folder in an absolute path");
                    break;
                default:
                    array_push($elements_out, $element);
            }
        }

        return $parsed["device"].implode($separator==self::SEPARATOR_BOTH? self::SEPARATOR_LINUX : $separator, $elements_out);
    }
public static function real ( $ input , $ separator = self :: SEPARATOR_BOTH ) { $ parsed = self :: parse ( $ input , $ separator ) ; if ( ! self :: validate ( $ parsed [ "path" ] ) ) throw new \ Exception ( "Path is invalid" ) ; $ elements_in = self :: explode ( $ parsed [ "path" ] , $ separator ) ; $ elements_out = array ( ) ; $ absolute = self :: isAbsolute ( $ input ) ; if ( self :: isAbsolute ( $ input ) ) array_push ( $ elements_out , null ) ; foreach ( $ elements_in as $ idx => $ element ) { switch ( $ element ) { case "" : case "." : break ; case ".." : if ( count ( $ elements_out ) > 0 && end ( $ elements_out ) != ".." ) array_pop ( $ elements_out ) ; elseif ( ! $ absolute ) array_push ( $ elements_out , ".." ) ; else throw new \ Exception ( "Can not move to parent of root folder in an absolute path" ) ; break ; default : array_push ( $ elements_out , $ element ) ; } } return $ parsed [ "device" ] . implode ( $ separator == self :: SEPARATOR_BOTH ? self :: SEPARATOR_LINUX : $ separator , $ elements_out ) ; }
Resolve a path and return a cleaned real path without checking physical files on any device

@static
@param        $input
@param string $separator
@return string
@throws \Exception
Resolve a path and return a cleaned real path without checking physical files on any device