Directory
extends Generic
in package
Class \Hoa\File\Directory.
Directory handler.
Tags
Table of Contents
Constants
- MODE_CREATE = 'xb'
- Open for reading and writing. If the directory does not exist, attempt to create it.
- MODE_CREATE_RECURSIVE = 'xrb'
- Open for reading and writing. If the directory does not exist, attempt to create it recursively.
- MODE_READ = 'rb'
- Open for reading.
Properties
- $_mode : string
- Mode.
Methods
- __construct() : mixed
- Open a directory.
- changeGroup() : bool
- Change file group.
- changeMode() : bool
- Change file mode.
- changeOwner() : bool
- Change file owner.
- clearAllStatisticCaches() : void
- Clear all files status cache.
- clearStatisticCache() : void
- Clear file status cache.
- copy() : bool
- Recursive copy of a directory.
- create() : bool
- Create a directory.
- delete() : bool
- Delete a directory.
- getATime() : int
- Get last access time of file.
- getBasename() : string
- Get filename component of path.
- getCTime() : int
- Get inode change time of file.
- getDirname() : string
- Get directory name component of path.
- getExtension() : string
- Get file extension (if exists).
- getFilename() : string
- Get filename without extension.
- getGroup() : int
- Get file group.
- getINode() : int
- Get inode.
- getMode() : string
- Get the open mode.
- getMTime() : int
- Get file modification time.
- getOwner() : int
- Get file owner.
- getPermissions() : int
- Get file permissions.
- getReadablePermissions() : string
- Get file permissions as a string.
- getRealPath() : string
- Get a canonicalized absolute pathname.
- getSize() : int
- Get size.
- getStatistic() : array<string|int, mixed>
- Get informations about a file.
- isBlockSpecial() : bool
- Check if it is block special.
- isCaseSensitive() : bool
- Check if the system is case sensitive or not.
- isCharacterSpecial() : bool
- Check if it is character special file.
- isDirectory() : bool
- Check if it is a directory.
- isExecutable() : bool
- Check if the file is executable.
- isFIFOPipe() : bool
- Check if it is a FIFO pipe.
- isFile() : bool
- Check if it is a file.
- isLink() : bool
- Check if it is a link.
- isReadable() : bool
- Check if the file is readable.
- isSocket() : bool
- Check if it is a socket.
- isUnknown() : bool
- Check if it is an unknown type.
- isWritable() : bool
- Check if the file is writable.
- move() : bool
- Move a file.
- touch() : bool
- Set access and modification time of file.
- umask() : int
- Change the current umask.
- _close() : bool
- Close the current stream.
- _open() : resource
- Open the stream and return the associated resource.
- setMode() : string
- Set the open mode.
Constants
MODE_CREATE
Open for reading and writing. If the directory does not exist, attempt to create it.
public
mixed
MODE_CREATE
= 'xb'
Tags
MODE_CREATE_RECURSIVE
Open for reading and writing. If the directory does not exist, attempt to create it recursively.
public
mixed
MODE_CREATE_RECURSIVE
= 'xrb'
Tags
MODE_READ
Open for reading.
public
mixed
MODE_READ
= 'rb'
Tags
Properties
$_mode
Mode.
protected
string
$_mode
= null
Methods
__construct()
Open a directory.
public
__construct(string $streamName[, string $mode = self::MODE_READ ][, string $context = null ][, bool $wait = false ]) : mixed
Parameters
- $streamName : string
-
Stream name.
- $mode : string = self::MODE_READ
-
Open mode, see the self::MODE* constants.
- $context : string = null
-
Context ID (please, see the \Hoa\Stream\Context class).
- $wait : bool = false
-
Differ opening or not.
changeGroup()
Change file group.
public
changeGroup(mixed $group) : bool
Parameters
- $group : mixed
-
Group name or number.
Return values
boolchangeMode()
Change file mode.
public
changeMode(int $mode) : bool
Parameters
- $mode : int
-
Mode (in octal!).
Return values
boolchangeOwner()
Change file owner.
public
changeOwner(mixed $user) : bool
Parameters
- $user : mixed
-
User.
Return values
boolclearAllStatisticCaches()
Clear all files status cache.
public
static clearAllStatisticCaches() : void
clearStatisticCache()
Clear file status cache.
public
clearStatisticCache() : void
copy()
Recursive copy of a directory.
public
copy(string $to[, bool $force = StreamIStreamTouchable::DO_NOT_OVERWRITE ]) : bool
Parameters
- $to : string
-
Destination path.
- $force : bool = StreamIStreamTouchable::DO_NOT_OVERWRITE
-
Force to copy if the file $to already exists. Use the \Hoa\Stream\IStream\Touchable::*OVERWRITE constants.
Tags
Return values
boolcreate()
Create a directory.
public
static create(string $name[, string $mode = self::MODE_CREATE_RECURSIVE ][, string $context = null ]) : bool
Parameters
- $name : string
-
Directory name.
- $mode : string = self::MODE_CREATE_RECURSIVE
-
Create mode. Please, see the self::MODE_CREATE* constants.
- $context : string = null
-
Context ID (please, see the \Hoa\Stream\Context class).
Tags
Return values
booldelete()
Delete a directory.
public
delete() : bool
Return values
boolgetATime()
Get last access time of file.
public
getATime() : int
Return values
intgetBasename()
Get filename component of path.
public
getBasename() : string
Return values
stringgetCTime()
Get inode change time of file.
public
getCTime() : int
Return values
intgetDirname()
Get directory name component of path.
public
getDirname() : string
Return values
stringgetExtension()
Get file extension (if exists).
public
getExtension() : string
Return values
stringgetFilename()
Get filename without extension.
public
getFilename() : string
Return values
stringgetGroup()
Get file group.
public
getGroup() : int
Return values
intgetINode()
Get inode.
public
getINode() : int
Return values
intgetMode()
Get the open mode.
public
getMode() : string
Return values
stringgetMTime()
Get file modification time.
public
getMTime() : int
Return values
intgetOwner()
Get file owner.
public
getOwner() : int
Return values
intgetPermissions()
Get file permissions.
public
getPermissions() : int
Return values
intgetReadablePermissions()
Get file permissions as a string.
public
getReadablePermissions() : string
Result sould be interpreted like this:
- s: socket;
- l: symbolic link;
- -: regular;
- b: block special;
- d: directory;
- c: character special;
- p: FIFO pipe;
- u: unknown.
Return values
stringgetRealPath()
Get a canonicalized absolute pathname.
public
getRealPath() : string
Return values
stringgetSize()
Get size.
public
getSize() : int
Return values
intgetStatistic()
Get informations about a file.
public
getStatistic() : array<string|int, mixed>
Return values
array<string|int, mixed>isBlockSpecial()
Check if it is block special.
public
isBlockSpecial() : bool
Return values
boolisCaseSensitive()
Check if the system is case sensitive or not.
public
static isCaseSensitive() : bool
Return values
boolisCharacterSpecial()
Check if it is character special file.
public
isCharacterSpecial() : bool
Return values
boolisDirectory()
Check if it is a directory.
public
isDirectory() : bool
Return values
boolisExecutable()
Check if the file is executable.
public
isExecutable() : bool
Return values
boolisFIFOPipe()
Check if it is a FIFO pipe.
public
isFIFOPipe() : bool
Return values
boolisFile()
Check if it is a file.
public
isFile() : bool
Return values
boolisLink()
Check if it is a link.
public
isLink() : bool
Return values
boolisReadable()
Check if the file is readable.
public
isReadable() : bool
Return values
boolisSocket()
Check if it is a socket.
public
isSocket() : bool
Return values
boolisUnknown()
Check if it is an unknown type.
public
isUnknown() : bool
Return values
boolisWritable()
Check if the file is writable.
public
isWritable() : bool
Return values
boolmove()
Move a file.
public
move(string $name[, bool $force = StreamIStreamTouchable::DO_NOT_OVERWRITE ][, bool $mkdir = StreamIStreamTouchable::DO_NOT_MAKE_DIRECTORY ]) : bool
Parameters
- $name : string
-
New name.
- $force : bool = StreamIStreamTouchable::DO_NOT_OVERWRITE
-
Force to move if the file $name already exists. Use the \Hoa\Stream\IStream\Touchable::*OVERWRITE constants.
- $mkdir : bool = StreamIStreamTouchable::DO_NOT_MAKE_DIRECTORY
-
Force to make directory if does not exist. Use the \Hoa\Stream\IStream\Touchable::*DIRECTORY constants.
Return values
booltouch()
Set access and modification time of file.
public
touch([int $time = -1 ][, int $atime = -1 ]) : bool
Parameters
- $time : int = -1
-
Time. If equals to -1, time() should be used.
- $atime : int = -1
-
Access time. If equals to -1, $time should be used.
Return values
boolumask()
Change the current umask.
public
static umask([int $umask = null ]) : int
Parameters
- $umask : int = null
-
Umask (in octal!). If null, given the current umask value.
Return values
int_close()
Close the current stream.
protected
_close() : bool
Return values
bool_open()
Open the stream and return the associated resource.
protected
& _open(string $streamName[, Context $context = null ]) : resource
Parameters
- $streamName : string
-
Stream name (e.g. path or URL).
- $context : Context = null
-
Context.
Tags
Return values
resourcesetMode()
Set the open mode.
protected
setMode(string $mode) : string
Parameters
- $mode : string
-
Open mode. Please, see the child::MODE_* constants.