PHP 클래스 JBZoo\Utils\FS

파일 보기 프로젝트 열기: jbzoo/utils 1 사용 예제들

공개 메소드들

메소드 설명
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