original_string: public function realpath($path)
      {
          $path = str_replace('\\', '/', rtrim($path, '/'));
          if ($path[0] != '/' && (strlen($path) < 2 || $path[1] != ':')) {
              $path = getcwd() . '/' . $path;
          }
          $parts = explode('/', $path);
          $path = [];
          foreach ($parts as $part) {
              if ($part == '..') {
                  array_pop($path);
              } else if ($part != '.') {
                  array_push($path, $part);
              }
          }
          return implode('/', $path);
      }
code: public function realpath($path)
      {
          $path = str_replace('\\', '/', rtrim($path, '/'));
          if ($path[0] != '/' && (strlen($path) < 2 || $path[1] != ':')) {
              $path = getcwd() . '/' . $path;
          }
          $parts = explode('/', $path);
          $path = [];
          foreach ($parts as $part) {
              if ($part == '..') {
                  array_pop($path);
              } else if ($part != '.') {
                  array_push($path, $part);
              }
          }
          return implode('/', $path);
      }
code_tokens: public function realpath ( $ path ) { $ path = str_replace ( '\\' , '/' , rtrim ( $ path , '/' ) ) ; if ( $ path [ 0 ] != '/' && ( strlen ( $ path ) < 2 || $ path [ 1 ] != ':' ) ) { $ path = getcwd ( ) . '/' . $ path ; } $ parts = explode ( '/' , $ path ) ; $ path = [ ] ; foreach ( $ parts as $ part ) { if ( $ part == '..' ) { array_pop ( $ path ) ; } else if ( $ part != '.' ) { array_push ( $ path , $ part ) ; } } return implode ( '/' , $ path ) ; }
docstring: Makes the path absolute and removes '.'
  and '..' directories from it.
  
  @param  string $path
  @return string
docstring_tokens: Makes the path absolute and removes . and .. directories from it .