Documentation

File
in package
implements JsonSerializable

Class for remote file operations.

This class provides functionalities to interact with remote files via FTP.

Table of Contents

Interfaces

JsonSerializable

Constants

MODE_APPEND  = "ab9"
Append mode
MODE_CREATEWRITE  = "wb9"
Create mode
MODE_READ  = "rb9"
Read mode
MODE_WRITE  = "wb9"
Write mode

Properties

$access  : mixed
$attributes  : string
$binary  : string
$content  : string
$directory  : mixed
$dotfile  : bool
$exists  : bool
$extension  : string
$filename  : string
$mimetype  : string
$name  : string
$path  : string
$size  : int
$_size  : int
The size of the file in bytes.
$cachePath  : string
The cache path for downloaded files.
$connection  : mixed
The FTP connection.
$finder  : mixed
The file finder.
$info  : array<string|int, mixed>
File path information.
$item  : object
The file item.

Methods

__construct()  : mixed
Constructor.
__get()  : mixed
Magic method for property access.
Download()  : bool
Download the file.
jsonSerialize()  : array<string|int, mixed>
Implements the JsonSerializable interface.
ToArray()  : array<string|int, mixed>
Converts file data to an array.

Constants

MODE_APPEND

Append mode

public mixed MODE_APPEND = "ab9"

MODE_CREATEWRITE

Create mode

public mixed MODE_CREATEWRITE = "wb9"

MODE_READ

Read mode

public mixed MODE_READ = "rb9"

MODE_WRITE

Write mode

public mixed MODE_WRITE = "wb9"

Properties

$access read-only

public mixed $access

The access permissions of the file.

$attributes read-only

public string $attributes

The file attributes.

$binary read-only

public string $binary

The binary content of the file.

$content read-only

public string $content

The content of the file.

$directory read-only

public mixed $directory

The directory containing the file.

$dotfile read-only

public bool $dotfile

Indicates if the file is a dot file.

$exists read-only

public bool $exists

Indicates if the file exists.

$extension read-only

public string $extension

The extension of the file.

$filename read-only

public string $filename

The file name.

$mimetype read-only

public string $mimetype

The MIME type of the file.

$name read-only

public string $name

The base name of the file.

$path read-only

public string $path

The full path to the file.

$size read-only

public int $size

The size of the file in bytes.

$_size

The size of the file in bytes.

private int $_size = 0

$cachePath

The cache path for downloaded files.

private string $cachePath

$connection

The FTP connection.

private mixed $connection

$finder

The file finder.

private mixed $finder

$info

File path information.

private array<string|int, mixed> $info

$item

The file item.

private object $item

Methods

__construct()

Constructor.

public __construct(object $item, mixed $connection, mixed $finder) : mixed

Initializes a new instance of the File class.

Parameters
$item : object

The file item.

$connection : mixed

The FTP connection.

$finder : mixed

The file finder.

__get()

Magic method for property access.

public __get(string $property) : mixed

Provides read-only access to various file properties.

Parameters
$property : string

The property to access.

Return values
mixed

The value of the accessed property.

Download()

Download the file.

public Download(string $localPath) : bool

Downloads the remote file to the specified local path.

Parameters
$localPath : string

The local path to save the file.

Return values
bool

Returns true if the download is successful, false otherwise.

jsonSerialize()

Implements the JsonSerializable interface.

public jsonSerialize() : array<string|int, mixed>

Serializes the file object to JSON.

Return values
array<string|int, mixed>

An array representation of the file for JSON serialization.

ToArray()

Converts file data to an array.

public ToArray() : array<string|int, mixed>

Converts various file properties to an associative array.

Return values
array<string|int, mixed>

An array representation of the file.


        
On this page

Search results