Directory
extends Node
in package
Class for working with directories.
Represents a class for handling directories.
Table of Contents
Properties
- $access : Security
- Access rights
- $attributes : Attributes
- Attributes
- $created : bool
- $current : int
- $dotfile : bool
- $hidden : bool
- $midified : bool
- $name : string
- $parent : Directory
- $path : string
- $pathArray : array<string|int, mixed>
- $readonly : bool
- $size : int
- $access : Security
- Access rights
- $attributes : Attributes
- Attributes
- $_parent : Directory
- Parent directory.
- $_pathArray : array<string|int, mixed>|null
- Path represented as an array.
- $path : string
- Path to the folder.
Methods
- __construct() : mixed
- Constructor.
- __get() : mixed
- Getter.
- __set() : void
- Setter
- Copy() : void
- Copies the directory.
- CopyTo() : void
- Copies the directory.
- Create() : Directory
- Создает директорию
- Delete() : void
- Deletes the directory from the disk.
- Exists() : bool
- Checks if the directory exists on the disk.
- IsDir() : bool
- Checks if it is a directory.
- Link() : mixed
- Creates a symbolic link.
- Move() : void
- Moves the directory.
- MoveTo() : void
- Moves the directory.
- PathInfo() : array<string|int, mixed>
- Retrieves information about a directory path.
- RealPath() : string|bool
- Returns the real path.
- ToArray() : array<string|int, mixed>
- Converts the directory object to an array.
- ToString() : string
- Returns the name of the directory.
- getAttributesObject() : Attributes
- Load attribute data.
- getSecurityObject() : Security
- Load access rights data.
Properties
$access read-only
Access rights
public
Security
$access
The security access of the directory.
$attributes read-only
Attributes
public
Attributes
$attributes
The attributes of the directory.
$created write-only
public
bool
$created
Indicates if the directory was created.
$current read-only
public
int
$current
The current directory.
$dotfile read-only
public
bool
$dotfile
Indicates if the directory is a dot file.
$hidden write-only
public
bool
$hidden
Indicates if the directory is hidden.
$midified write-only
public
bool
$midified
Indicates if the directory was modified.
$name read-only
public
string
$name
The name of the directory.
$parent read-only
public
Directory
$parent
The parent directory.
$path read-only
public
string
$path
The path of the directory.
$pathArray read-only
public
array<string|int, mixed>
$pathArray
The array representation of the directory path.
$readonly write-only
public
bool
$readonly
Indicates if the directory is read-only.
$size read-only
public
int
$size
The size of the directory.
$access
Access rights
protected
Security
$access
= null
$attributes
Attributes
protected
Attributes
$attributes
= null
$_parent
Parent directory.
private
Directory
$_parent
= null
Represents the parent directory.
$_pathArray
Path represented as an array.
private
array<string|int, mixed>|null
$_pathArray
= null
Represents the path of the folder as an array.
$path
Path to the folder.
private
string
$path
Represents the path to the folder.
Methods
__construct()
Constructor.
public
__construct(string $path) : mixed
Initializes a new instance of the Directory class.
Parameters
- $path : string
-
The path to the directory.
__get()
Getter.
public
__get(string $property) : mixed
Retrieves the value of a property.
Parameters
- $property : string
-
The property to retrieve.
Return values
mixed —The value of the property.
__set()
Setter
public
__set(string $property, mixed $value) : void
Parameters
- $property : string
-
Property
- $value : mixed
-
Value
Copy()
Copies the directory.
public
static Copy(string $from, string $to) : void
Parameters
- $from : string
-
The directory to copy from.
- $to : string
-
The destination directory.
CopyTo()
Copies the directory.
public
CopyTo(string $path) : void
Parameters
- $path : string
-
The path where the directory will be copied.
Create()
Создает директорию
public
static Create(string $path[, bool $recursive = true ][, string $mode = '777' ]) : Directory
Parameters
- $path : string
-
пусть к директории
- $recursive : bool = true
-
если true то директории будут созданы по всему пути до достижения указанной директории
- $mode : string = '777'
-
режим создания по умолчанию 777
Return values
DirectoryDelete()
Deletes the directory from the disk.
public
static Delete(string $path) : void
Parameters
- $path : string
-
The path to the directory.
Exists()
Checks if the directory exists on the disk.
public
static Exists(string $path) : bool
Parameters
- $path : string
-
The path to the directory.
Return values
boolIsDir()
Checks if it is a directory.
public
static IsDir(string $path) : bool
Parameters
- $path : string
Return values
boolLink()
Creates a symbolic link.
public
static Link(string $sourcePath, string $destPath[, bool $recursive = true ][, string $mode = '777' ]) : mixed
Parameters
- $sourcePath : string
-
The path to the source file or directory.
- $destPath : string
-
The path to the destination where the link will be created.
- $recursive : bool = true
-
Whether to create parent directories if they don't exist. Defaults to true.
- $mode : string = '777'
-
The mode for the parent directory if it needs to be created. Defaults to '777'.
Move()
Moves the directory.
public
static Move(string $from, string $to) : void
Parameters
- $from : string
-
The directory to move.
- $to : string
-
The destination directory.
MoveTo()
Moves the directory.
public
MoveTo(string $path) : void
Parameters
- $path : string
-
The path where to move the directory.
PathInfo()
Retrieves information about a directory path.
public
static PathInfo(string $filename) : array<string|int, mixed>
Parameters
- $filename : string
-
The directory path.
Return values
array<string|int, mixed> —An array containing information about the directory.
RealPath()
Returns the real path.
public
static RealPath(mixed $path) : string|bool
Parameters
- $path : mixed
-
The relative path.
Return values
string|bool —The real path or false if the path does not exist.
ToArray()
Converts the directory object to an array.
public
ToArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array representation of the directory object.
ToString()
Returns the name of the directory.
public
ToString() : string
Return values
stringgetAttributesObject()
Load attribute data.
protected
getAttributesObject() : Attributes
Return values
AttributesgetSecurityObject()
Load access rights data.
protected
getSecurityObject() : Security