original_string: public function get_path($path)
  	{
  		$pathinfo = is_dir($path) ? array('dirname' => $path, 'extension' => null, 'basename' => '') : pathinfo($path);
  
  		// make sure we have a dirname to work with
  		isset($pathinfo['dirname']) or $pathinfo['dirname'] = '';
  
  		// do we have a basedir, and is the path already prefixed by the basedir? then just deal with the double dots...
  		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) == $this->basedir)
  		{
  			$pathinfo['dirname'] = realpath($pathinfo['dirname']);
  		}
  		else
  		{
  			// attempt to get the realpath(), otherwise just use path with any double dots taken out when basedir is set (for security)
  			$pathinfo['dirname'] = ( ! empty($this->basedir) ? realpath($this->basedir.DS.$pathinfo['dirname']) : realpath($pathinfo['dirname']) )
  					?: ( ! empty($this->basedir) ? $this->basedir.DS.str_replace('..', '', $pathinfo['dirname']) : $pathinfo['dirname']);
  		}
  
  		// basedir prefix is required when it is set (may cause unexpected errors when realpath doesn't work)
  		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) != $this->basedir)
  		{
  			throw new \OutsideAreaException('File operation not allowed: given path is outside the basedir for this area.');
  		}
  
  		// check file extension
  		if ( ! empty(static::$extensions) && array_key_exists($pathinfo['extension'], static::$extensions))
  		{
  			throw new \FileAccessException('File operation not allowed: disallowed file extension.');
  		}
  
  		return $pathinfo['dirname'].DS.$pathinfo['basename'];
  	}
code: public function get_path($path)
  	{
  		$pathinfo = is_dir($path) ? array('dirname' => $path, 'extension' => null, 'basename' => '') : pathinfo($path);
  
  		// make sure we have a dirname to work with
  		isset($pathinfo['dirname']) or $pathinfo['dirname'] = '';
  
  		// do we have a basedir, and is the path already prefixed by the basedir? then just deal with the double dots...
  		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) == $this->basedir)
  		{
  			$pathinfo['dirname'] = realpath($pathinfo['dirname']);
  		}
  		else
  		{
  			// attempt to get the realpath(), otherwise just use path with any double dots taken out when basedir is set (for security)
  			$pathinfo['dirname'] = ( ! empty($this->basedir) ? realpath($this->basedir.DS.$pathinfo['dirname']) : realpath($pathinfo['dirname']) )
  					?: ( ! empty($this->basedir) ? $this->basedir.DS.str_replace('..', '', $pathinfo['dirname']) : $pathinfo['dirname']);
  		}
  
  		// basedir prefix is required when it is set (may cause unexpected errors when realpath doesn't work)
  		if ( ! empty($this->basedir) && substr($pathinfo['dirname'], 0, strlen($this->basedir)) != $this->basedir)
  		{
  			throw new \OutsideAreaException('File operation not allowed: given path is outside the basedir for this area.');
  		}
  
  		// check file extension
  		if ( ! empty(static::$extensions) && array_key_exists($pathinfo['extension'], static::$extensions))
  		{
  			throw new \FileAccessException('File operation not allowed: disallowed file extension.');
  		}
  
  		return $pathinfo['dirname'].DS.$pathinfo['basename'];
  	}
code_tokens: public function get_path ( $ path ) { $ pathinfo = is_dir ( $ path ) ? array ( 'dirname' => $ path , 'extension' => null , 'basename' => '' ) : pathinfo ( $ path ) ; // make sure we have a dirname to work with isset ( $ pathinfo [ 'dirname' ] ) or $ pathinfo [ 'dirname' ] = '' ; // do we have a basedir, and is the path already prefixed by the basedir? then just deal with the double dots... if ( ! empty ( $ this -> basedir ) && substr ( $ pathinfo [ 'dirname' ] , 0 , strlen ( $ this -> basedir ) ) == $ this -> basedir ) { $ pathinfo [ 'dirname' ] = realpath ( $ pathinfo [ 'dirname' ] ) ; } else { // attempt to get the realpath(), otherwise just use path with any double dots taken out when basedir is set (for security) $ pathinfo [ 'dirname' ] = ( ! empty ( $ this -> basedir ) ? realpath ( $ this -> basedir . DS . $ pathinfo [ 'dirname' ] ) : realpath ( $ pathinfo [ 'dirname' ] ) ) ? : ( ! empty ( $ this -> basedir ) ? $ this -> basedir . DS . str_replace ( '..' , '' , $ pathinfo [ 'dirname' ] ) : $ pathinfo [ 'dirname' ] ) ; } // basedir prefix is required when it is set (may cause unexpected errors when realpath doesn't work) if ( ! empty ( $ this -> basedir ) && substr ( $ pathinfo [ 'dirname' ] , 0 , strlen ( $ this -> basedir ) ) != $ this -> basedir ) { throw new \ OutsideAreaException ( 'File operation not allowed: given path is outside the basedir for this area.' ) ; } // check file extension if ( ! empty ( static :: $ extensions ) && array_key_exists ( $ pathinfo [ 'extension' ] , static :: $ extensions ) ) { throw new \ FileAccessException ( 'File operation not allowed: disallowed file extension.' ) ; } return $ pathinfo [ 'dirname' ] . DS . $ pathinfo [ 'basename' ] ; }
docstring: Translate relative path to real path, throws error when operation is not allowed
  
  @param	string
  @return	string
  @throws	FileAccessException	when outside basedir restriction or disallowed file extension
docstring_tokens: Translate relative path to real path throws error when operation is not allowed