C# Class Pchp.Library.PhpPath

Mostrar archivo Open project: iolevel/peachpie Class Usage Examples

Public Methods

Method Description
basename ( string path, string suffix = null ) : string

Returns path component of path.

Given a string containing a path to a file, this function will return the base name of the file. If the path ends in this will also be cut off. On Windows, both slash (/) and backslash (\) are used as path separator character. In other environments, it is the forward slash (/).

dirname ( string path, int levels = 1 ) : string

Returns directory name component of path.

pathinfo ( string path, PathInfoOptions options = PathInfoOptions.All ) : PhpValue

Extracts part(s) from a specified path.

realpath ( string path ) : string

Returns canonicalized absolute path name.

sys_get_temp_dir ( ) : string

Returns the path of the directory PHP stores temporary files in by default.

Path ends with "\"

tempnam ( string dir, string prefix ) : string

Creates a file with a unique path in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that.

Private Methods

Method Description
AbsolutePath ( string path ) : string

Merges the path with the current working directory to get a canonicalized absolute pathname representing the same path (local files only). If the provided path is absolute (rooted local path or an URL) it is returned unchanged.

GetFilename ( string path ) : string

Returns the given filesystem url without the scheme.

GetScheme ( string path ) : string

Wrapper-safe method of getting the schema portion from an URL.

GetUrl ( string absolutePath ) : string

Concatenates a scheme with the given absolute path if necessary.

IsLocalFile ( string url ) : bool

Check if the given path is a path to a local file.

IsRemoteFile ( string url ) : bool

Check if the given path is a remote url.

Method Details

basename() public static method

Returns path component of path.
Given a string containing a path to a file, this function will return the base name of the file. If the path ends in this will also be cut off. On Windows, both slash (/) and backslash (\) are used as path separator character. In other environments, it is the forward slash (/).
public static basename ( string path, string suffix = null ) : string
path string A containing a path to a file.
suffix string A containing suffix to be cut off the path if present.
return string

dirname() public static method

Returns directory name component of path.
public static dirname ( string path, int levels = 1 ) : string
path string The full path.
levels int The number of parent directories to go up. Must be greater than zero.
return string

pathinfo() public static method

Extracts part(s) from a specified path.
public static pathinfo ( string path, PathInfoOptions options = PathInfoOptions.All ) : PhpValue
path string The path to be parsed.
options PathInfoOptions Flags determining the result.
return Pchp.Core.PhpValue

realpath() public static method

Returns canonicalized absolute path name.
public static realpath ( string path ) : string
path string Arbitrary path.
return string

sys_get_temp_dir() public static method

Returns the path of the directory PHP stores temporary files in by default.
Path ends with "\"
public static sys_get_temp_dir ( ) : string
return string

tempnam() public static method

Creates a file with a unique path in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that.
public static tempnam ( string dir, string prefix ) : string
dir string The directory where the temporary file should be created.
prefix string The prefix of the unique path.
return string