Finder
in package
Class for finding files and directories.
Table of Contents
Properties
- $_connection : mixed
- The FTP connection.
- $_connectionInfo : object
- The FTP connection information.
Methods
- __construct() : mixed
- Constructor.
- __destruct() : mixed
- Destructor.
- Files() : ArrayList
- Lists files in the specified path.
- Reconnect() : mixed
- Reconnects to the FTP server.
- _connect() : mixed
- Establishes the FTP connection.
- _ftpList() : array<string|int, mixed>
- Lists files and directories via FTP.
Properties
$_connection
The FTP connection.
private
mixed
$_connection
$_connectionInfo
The FTP connection information.
private
object
$_connectionInfo
Methods
__construct()
Constructor.
public
__construct(object $connectionInfo) : mixed
Initializes a new instance of the Finder class.
Parameters
- $connectionInfo : object
-
The FTP connection information.
__destruct()
Destructor.
public
__destruct() : mixed
Closes the FTP connection when the object is destroyed.
Files()
Lists files in the specified path.
public
Files(string $path[, string $match = '/.*/' ][, string $sortField = '' ][, int $sortType = SORT_ASC ]) : ArrayList
Parameters
- $path : string
-
The path to search.
- $match : string = '/.*/'
-
Regular expression to match file names.
- $sortField : string = ''
-
Field for sorting.
- $sortType : int = SORT_ASC
-
Sorting type.
Return values
ArrayList —An ArrayList containing found files.
Reconnect()
Reconnects to the FTP server.
public
Reconnect() : mixed
Return values
mixed —The FTP connection.
_connect()
Establishes the FTP connection.
private
_connect() : mixed
Tags
_ftpList()
Lists files and directories via FTP.
private
_ftpList(string $path[, bool $recursive = false ]) : array<string|int, mixed>
Parameters
- $path : string
-
The path to list.
- $recursive : bool = false
-
Whether to list recursively.
Return values
array<string|int, mixed> —An array containing FTP file information.