PHP Класс JBZoo\Utils\FS

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
base ( string $path ) : string
clean ( string $path, string $dirSep = DIRECTORY_SEPARATOR ) : string Function to strip additional / or \ in a path name.
dirSize ( string $dir ) : integer Returns size of a given directory in bytes.
dirname ( string $path ) : string
executable ( string $filename, boolean $executable = true ) : boolean Set the executable bit on a file to the minimum value that allows the user running PHP to read to it.
ext ( string $path ) : string
filename ( string $path ) : string
firstLine ( string $filepath ) : string Quickest way for getting first file line
format ( integer $bytes, integer $decimals = 2 ) : string Nice formatting for computer sizes (Bytes).
getRelative ( string $filePath, string | null $rootPath = null, string $forceDS = DIRECTORY_SEPARATOR, boolean $toRealpath = true ) : mixed Find relative path of file (remove root part)
isDir ( string $path ) : boolean Check is current path directory
isFile ( string $path ) : boolean Check is current path regular file
isReal ( $path ) : boolean
ls ( string $dir ) : array Returns all paths inside a directory.
openFile ( $filepath ) : null | string Binary safe to open file
perms ( string $file, integer $perms = null ) : string Returns the file permissions as a nice string, like -rw-r--r-- or false if the file is not found.
readable ( string $filename, boolean $readable = true ) : boolean Set the readable bit on a file to the minimum value that allows the user running PHP to read to it.
real ( string $path ) : string
rmdir ( string $dir, boolean $traverseSymlinks = false ) : boolean Removes a directory (and its contents) recursively.
stripExt ( string $path ) : string Strip off the extension if it exists.
writable ( string $filename, boolean $writable = true ) : boolean Set the writable bit on a file to the minimum value that allows the user running PHP to write to it.

Защищенные методы

Метод Описание
_chmod ( string $filename, integer $perm, integer $add ) : boolean Chmod alias
_setPerms ( string $filename, boolean $isFlag, integer $perm ) : boolean

Описание методов

_chmod() защищенный статический Метод

Chmod alias
protected static _chmod ( string $filename, integer $perm, integer $add ) : boolean
$filename string
$perm integer
$add integer
Результат boolean

_setPerms() защищенный статический Метод

protected static _setPerms ( string $filename, boolean $isFlag, integer $perm ) : boolean
$filename string
$isFlag boolean
$perm integer
Результат boolean

base() публичный статический Метод

public static base ( string $path ) : string
$path string
Результат string

clean() публичный статический Метод

Function to strip additional / or \ in a path name.
public static clean ( string $path, string $dirSep = DIRECTORY_SEPARATOR ) : string
$path string The path to clean.
$dirSep string Directory separator (optional).
Результат string

dirSize() публичный статический Метод

Returns size of a given directory in bytes.
public static dirSize ( string $dir ) : integer
$dir string
Результат integer

dirname() публичный статический Метод

public static dirname ( string $path ) : string
$path string
Результат string

executable() публичный статический Метод

Set the executable bit on a file to the minimum value that allows the user running PHP to read to it.
public static executable ( string $filename, boolean $executable = true ) : boolean
$filename string The filename to set the executable bit on
$executable boolean Whether to make the file executable or not
Результат boolean

ext() публичный статический Метод

public static ext ( string $path ) : string
$path string
Результат string

filename() публичный статический Метод

public static filename ( string $path ) : string
$path string
Результат string

firstLine() публичный статический Метод

Quickest way for getting first file line
public static firstLine ( string $filepath ) : string
$filepath string
Результат string

format() публичный статический Метод

Nice formatting for computer sizes (Bytes).
public static format ( integer $bytes, integer $decimals = 2 ) : string
$bytes integer The number in bytes to format
$decimals integer The number of decimal points to include
Результат string

getRelative() публичный статический Метод

Find relative path of file (remove root part)
public static getRelative ( string $filePath, string | null $rootPath = null, string $forceDS = DIRECTORY_SEPARATOR, boolean $toRealpath = true ) : mixed
$filePath string
$rootPath string | null
$forceDS string
$toRealpath boolean
Результат mixed

isDir() публичный статический Метод

Check is current path directory
public static isDir ( string $path ) : boolean
$path string
Результат boolean

isFile() публичный статический Метод

Check is current path regular file
public static isFile ( string $path ) : boolean
$path string
Результат boolean

isReal() публичный статический Метод

public static isReal ( $path ) : boolean
$path
Результат boolean

ls() публичный статический Метод

Returns all paths inside a directory.
public static ls ( string $dir ) : array
$dir string
Результат array

openFile() публичный статический Метод

Binary safe to open file
public static openFile ( $filepath ) : null | string
$filepath
Результат null | string

perms() публичный статический Метод

Returns the file permissions as a nice string, like -rw-r--r-- or false if the file is not found.
public static perms ( string $file, integer $perms = null ) : string
$file string The name of the file to get permissions form
$perms integer Numerical value of permissions to display as text.
Результат string

readable() публичный статический Метод

Set the readable bit on a file to the minimum value that allows the user running PHP to read to it.
public static readable ( string $filename, boolean $readable = true ) : boolean
$filename string The filename to set the readable bit on
$readable boolean Whether to make the file readable or not
Результат boolean

real() публичный статический Метод

public static real ( string $path ) : string
$path string
Результат string

rmdir() публичный статический Метод

Contributed by Askar (ARACOOL)
public static rmdir ( string $dir, boolean $traverseSymlinks = false ) : boolean
$dir string The directory to be deleted recursively
$traverseSymlinks boolean Delete contents of symlinks recursively
Результат boolean

stripExt() публичный статический Метод

Strip off the extension if it exists.
public static stripExt ( string $path ) : string
$path string
Результат string

writable() публичный статический Метод

Set the writable bit on a file to the minimum value that allows the user running PHP to write to it.
public static writable ( string $filename, boolean $writable = true ) : boolean
$filename string The filename to set the writable bit on
$writable boolean Whether to make the file writable or not
Результат boolean