code: protected static function examine($part, array &$array, $path_relative, $allow_escape = false)
    {
      if($part === '.')
      {
        return;
      }
  
      if($part !== '..')
      {
        $array[] = $part;
        return;
      }
  
      // $part == '..', handle escaping.
      $last = end($array);
      if($last === '..')
      { // Escaping is allowed and we're already on the run.
        $array[] = $part;
        return;
      }
  
      if($last !== false)
      { // $last element exists - move up the stack.
        array_pop($array);
        return;
      }
  
      if(!$path_relative)
      { // Path is not relative - skip updir.
        return;
      }
  
      if(!$allow_escape)
        throw new \UnexpectedValueException('Attempt to traverse outside the root directory.');
  
      $array[] = $part;
    }
docs: Path normalizer part examinator.
  @internal
  @throws \UnexpectedValueException if relative path is trying to escape above current directory, unless explicitly allowed.