PHP Interface Kraken\Filesystem\FilesystemInterface

显示文件 Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
append ( string $path, string $contents ) Appends contents to file.
copyDir ( string $source, string $destination ) Copy a directory.
copyFile ( string $source, string $destination ) Copy a file.
create ( string $path, string $contents ) Create a new file or overwrite existing one.
createDir ( string $dirname, string $visibility = Filesystem::VISIBILITY_DEFAULT ) Create a directory.
createFile ( string $path, string $contents = '', string $visibility = Filesystem::VISIBILITY_DEFAULT ) Create a new file.
eraseDir ( string $dirname = '' ) Erase a directory.
eraseFile ( string $path ) Erase a file.
exists ( string $path ) : boolean Check whether a file or directory exist.
getContents ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array List contents of a directory.
getDirectories ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array List directories of a directory.
getFiles ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array List files of a directory.
getMimetype ( string $path ) : string Get mimetype of a file.
getSize ( $path ) : integer Returns size of a file.
getTimestamp ( string $path ) : string Get timestamp of a file.
getType ( string $path ) : string Get type of a file.
getVisibility ( string $path ) : string Get visibility of a file or directory.
isDir ( string $path ) : boolean Check if path is a file.
isFile ( string $path ) : boolean Check if path is a file.
isPrivate ( string $path = '' ) : boolean Check if file or directory is private.
isPublic ( string $path = '' ) : boolean Check if file or directory is public.
move ( string $source, string $destination ) Move (rename) a file or directory.
prepend ( string $path, string $contents ) Prepends contents to file.
read ( string $path ) : string Read a file.
removeDir ( string $dirname ) Remove a directory.
removeFile ( string $path ) Remove a file.
req ( string $path ) : mixed Require a file.
setPrivate ( string $path = '' ) Sets visibility of file or directory to private.
setPublic ( string $path = '' ) Sets visibility of file or directory to public.
setVisibility ( string $path, string $visibility ) Set visibility of a file or directory.
write ( string $path, string $contents ) Overwrite existing file.

Method Details

append() public method

Appends contents to file.
public append ( string $path, string $contents )
$path string
$contents string

copyDir() public method

Copy a directory.
public copyDir ( string $source, string $destination )
$source string
$destination string

copyFile() public method

Copy a file.
public copyFile ( string $source, string $destination )
$source string
$destination string

create() public method

Create a new file or overwrite existing one.
public create ( string $path, string $contents )
$path string
$contents string

createDir() public method

Create a directory.
public createDir ( string $dirname, string $visibility = Filesystem::VISIBILITY_DEFAULT )
$dirname string
$visibility string

createFile() public method

Create a new file.
public createFile ( string $path, string $contents = '', string $visibility = Filesystem::VISIBILITY_DEFAULT )
$path string
$contents string
$visibility string

eraseDir() public method

Erase a directory.
public eraseDir ( string $dirname = '' )
$dirname string

eraseFile() public method

Erase a file.
public eraseFile ( string $path )
$path string

exists() public method

Check whether a file or directory exist.
public exists ( string $path ) : boolean
$path string
return boolean

getContents() public method

List contents of a directory.
public getContents ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array
$directory string
$recursive boolean
$filterPatterns string | string[]
return array

getDirectories() public method

List directories of a directory.
public getDirectories ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array
$directory string
$recursive boolean
$filterPatterns string | string[]
return array

getFiles() public method

List files of a directory.
public getFiles ( string $directory = '', boolean $recursive = false, string | string[] $filterPatterns = [] ) : array
$directory string
$recursive boolean
$filterPatterns string | string[]
return array

getMimetype() public method

Get mimetype of a file.
public getMimetype ( string $path ) : string
$path string
return string

getSize() public method

Returns size of a file.
public getSize ( $path ) : integer
$path
return integer

getTimestamp() public method

Get timestamp of a file.
public getTimestamp ( string $path ) : string
$path string
return string

getType() public method

Get type of a file.
public getType ( string $path ) : string
$path string
return string

getVisibility() public method

Get visibility of a file or directory.
public getVisibility ( string $path ) : string
$path string
return string

isDir() public method

Check if path is a file.
public isDir ( string $path ) : boolean
$path string
return boolean

isFile() public method

Check if path is a file.
public isFile ( string $path ) : boolean
$path string
return boolean

isPrivate() public method

Check if file or directory is private.
public isPrivate ( string $path = '' ) : boolean
$path string
return boolean

isPublic() public method

Check if file or directory is public.
public isPublic ( string $path = '' ) : boolean
$path string
return boolean

move() public method

Move (rename) a file or directory.
public move ( string $source, string $destination )
$source string
$destination string

prepend() public method

Prepends contents to file.
public prepend ( string $path, string $contents )
$path string
$contents string

read() public method

Read a file.
public read ( string $path ) : string
$path string
return string

removeDir() public method

Remove a directory.
public removeDir ( string $dirname )
$dirname string

removeFile() public method

Remove a file.
public removeFile ( string $path )
$path string

req() public method

Require a file.
public req ( string $path ) : mixed
$path string
return mixed

setPrivate() public method

Sets visibility of file or directory to private.
public setPrivate ( string $path = '' )
$path string

setPublic() public method

Sets visibility of file or directory to public.
public setPublic ( string $path = '' )
$path string

setVisibility() public method

Set visibility of a file or directory.
public setVisibility ( string $path, string $visibility )
$path string
$visibility string

write() public method

Overwrite existing file.
public write ( string $path, string $contents )
$path string
$contents string