protected Backend $backend
protected Manager $manager
protected bool $allow_hidden
public string $relative_path
public __construct(string $path, ?Manager $manager, ?string $relative_path): void
Parameter | Type | Description |
---|
$path | string | |
$manager | Manager | |
$relative_path | string | |
public __toString(): string
public getManager(): Manager
public setMeta(array $values): bool
Parameter | Type | Description |
---|
$values | array | |
public getMeta(?string $key): mixed
Parameter | Type | Description |
---|
$key | string | |
public toString(): string
public path(?string $suffix): string
Parameter | Type | Description |
---|
$suffix | string | |
public fullpath(?string $suffix): string
Parameter | Type | Description |
---|
$suffix | string | |
Get the relative path of the directory.
public relativepath(string $path): string
If the file was returned from a [[Hazaar\File\Dir]] object, then it will have a stored relative path. Otherwise any file/path can be provided in the form of another [[Hazaar\File\ object, [[Hazaar\File\Dir]] object, or string path, and the relative path to the file will be returned.
Parameter | Type | Description |
---|
$path | string | |
public setRelativePath(string $path): void
Parameter | Type | Description |
---|
$path | string | |
public realpath(): string
public extension(): string
public basename(): string
public exists(?string $filename): bool
Parameter | Type | Description |
---|
$filename | string | |
public isReadable(): bool
public isWritable(): bool
public allowHidden(bool $toggle = true): void
Parameter | Type | Description |
---|
$toggle | bool | |
public create(bool $recursive = false): bool
Parameter | Type | Description |
---|
$recursive | bool | |
public rename(string $newname): bool
Parameter | Type | Description |
---|
$newname | string | |
Delete the directory, optionally removing all it's contents.
public delete(bool $recursive = false): bool
Executing this method will simply delete or "unlink" the directory. Normally it must be empty to succeed. However specifying the $recursive parameter as TRUE will delete everything inside the directory, recursively (obviously).
Parameter | Type | Description |
---|
$recursive | bool | |
File::unlink() compatible delete that removes dir and all contents (ie: recursive).
Empty a directory of all it's contents.
public (boolean $include_hidden = false): void
This is the same as calling delete(true) except that the directory itself is not deleted.
By default hidden files are not deleted. This is for protection. You can choose to delete them as well by setting $include_hidden to true.
Parameter | Type | Description |
---|
$include_hidden | boolean | also delete hidden files |
public read(?string $regex_filter): File
Parameter | Type | Description |
---|
$regex_filter | string | |
Find files in the current path optionally recursing into sub directories.
public find(string $pattern, bool $show_hidden = false, bool $case_sensitive = true, ?int $depth): void
Parameter | Type | Description |
---|
$pattern | string | The pattern to match against. This can be either a wildcard string, such as |
"*.txt" or a regex pattern. Regex is detected if the string is longer than a
single character and first character is the same as the last. |
| $show_hidden
| bool
| | | $case_sensitive
| bool
| if TRUE character case will be honoured | | $depth
| int
| Recursion depth. NULL will always recurse. 0 will prevent recursion. |
public copyTo(string $target, bool $recursive = false, \Closure $transport_callback): bool
Parameter | Type | Description |
---|
$target | string | |
$recursive | bool | |
$transport_callback | \Closure | |
public get(string $child, bool $force_dir = false): File
Parameter | Type | Description |
---|
$child | string | |
$force_dir | bool | |
public getDir(string $path): Dir
Parameter | Type | Description |
---|
$path | string | |
public mimeContentType(): string
public dir(?string $child): Dir
Parameter | Type | Description |
---|
$child | string | |
Copy a file object into the current directory.
public put(File $file, bool $overwrite = false): File
Parameter | Type | Description |
---|
$file | File | The file to put in this directory |
$overwrite | bool | |
Download a file from a URL directly to the directory and return a new File object.
public download(mixed $source_url, int $timeout = 60): void
This is useful for download large files as this method will write the file directly to storage. Currently, only local storage is supported as this uses OS file access.
Parameter | Type | Description |
---|
$source_url | mixed | The source URL of the file to download |
$timeout | int | The download timeout after which an exception will be thrown |
public mediaURL(URL $set_path): ?URL
Parameter | Type | Description |
---|
$set_path | URL | |
public sync(Dir $source, bool $recursive = false, \Closure $progress_callback, int $max_retries = 3): bool
Parameter | Type | Description |
---|
$source | Dir | |
$recursive | bool | |
$progress_callback | \Closure | |
$max_retries | int | |
public write(string $file, string $bytes, ?string $content_type): ?int
Parameter | Type | Description |
---|
$file | string | |
$bytes | string | |
$content_type | string | |
private callSyncCallback(): bool
Generated by Hazaar API Doc Generator