AbstractFtpAdapter
        
        extends AbstractAdapter
    
    
            
            in package
            
        
    
    
    
        
        
    
Table of Contents
- $configurable : array<string|int, mixed>
 - $connection : mixed
 - $enableTimestampsOnUnixListings : bool
 - True to enable timestamps for FTP servers that return unix-style listings.
 - $host : string
 - $passive : bool
 - $pathPrefix : string|null
 - $pathSeparator : string
 - $permPrivate : int
 - $permPublic : int
 - $port : int
 - $root : string|null
 - $safeStorage : SafeStorage
 - $separator : string
 - $ssl : bool
 - $systemType : string
 - $timeout : int
 - __construct() : mixed
 - Constructor.
 - __destruct() : mixed
 - Disconnect on destruction.
 - applyPathPrefix() : string
 - Prefix a path.
 - connect() : mixed
 - Establish a connection.
 - disconnect() : mixed
 - Close the connection.
 - ensureDirectory() : mixed
 - Ensure a directory exists.
 - getConnection() : mixed
 - getHost() : string
 - Returns the host.
 - getPassword() : string
 - Returns the password.
 - getPathPrefix() : string|null
 - Get the path prefix.
 - getPermPrivate() : int
 - Get the private permission value.
 - getPermPublic() : int
 - Get the public permission value.
 - getPort() : int
 - Returns the ftp port.
 - getRoot() : string
 - Returns the root folder to work from.
 - getSize() : mixed
 - getSystemType() : string
 - Return the FTP system type.
 - getTimeout() : int
 - Returns the amount of seconds before the connection will timeout.
 - getUsername() : string
 - Returns the ftp username.
 - getVisibility() : mixed
 - has() : mixed
 - isConnected() : bool
 - Check if a connection is active.
 - listContents() : mixed
 - removeDotDirectories() : array<string|int, mixed>
 - Filter out dot-directories.
 - removePathPrefix() : string
 - Remove a path prefix.
 - setConfig() : $this
 - Set the config.
 - setEnableTimestampsOnUnixListings() : $this
 - True to enable timestamps for FTP servers that return unix-style listings.
 - setHost() : $this
 - Set the host.
 - setPassword() : $this
 - Set the ftp password.
 - setPathPrefix() : void
 - Set the path prefix.
 - setPermPrivate() : $this
 - Set the private permission value.
 - setPermPublic() : $this
 - Set the public permission value.
 - setPort() : $this
 - Set the ftp port.
 - setRoot() : $this
 - Set the root folder to work from.
 - setSystemType() : $this
 - Set the FTP system type (windows or unix).
 - setTimeout() : $this
 - Set the amount of seconds before the connection should timeout.
 - setUsername() : $this
 - Set ftp username.
 - detectSystemType() : string
 - Get the system type from a listing item.
 - detectType() : string
 - Get the file type from the permissions.
 - escapePath() : mixed
 - listDirectoryContents() : mixed
 - normalizeListing() : array<string|int, mixed>
 - Normalize a directory listing.
 - normalizeObject() : array<string|int, mixed>
 - Normalize a file entry.
 - normalizePermissions() : int
 - Normalize a permissions string.
 - normalizeUnixObject() : array<string|int, mixed>
 - Normalize a Unix file entry.
 - normalizeUnixTimestamp() : int
 - Only accurate to the minute (current year), or to the day.
 - normalizeWindowsObject() : array<string|int, mixed>
 - Normalize a Windows/DOS file entry.
 - sortListing() : array<string|int, mixed>
 - Sort a directory listing.
 
Properties
$configurable
    protected
        array<string|int, mixed>
    $configurable
     = []
    
    
    
$connection
    protected
        mixed
    $connection
    
    
    
    
$enableTimestampsOnUnixListings
True to enable timestamps for FTP servers that return unix-style listings.
    protected
        bool
    $enableTimestampsOnUnixListings
     = false
    
    
    
$host
    protected
        string
    $host
    
    
    
    
$passive
    protected
        bool
    $passive
     = true
    
    
    
$pathPrefix
    protected
        string|null
    $pathPrefix
    
    
        path prefix
$pathSeparator
    protected
        string
    $pathSeparator
     = '/'
    
    
    
$permPrivate
    protected
        int
    $permPrivate
     = 0700
    
    
    
$permPublic
    protected
        int
    $permPublic
     = 0744
    
    
    
$port
    protected
        int
    $port
     = 21
    
    
    
$root
    protected
        string|null
    $root
    
    
    
    
$safeStorage
    protected
        SafeStorage
    $safeStorage
    
    
    
    
$separator
    protected
        string
    $separator
     = '/'
    
    
    
$ssl
    protected
        bool
    $ssl
     = false
    
    
    
$systemType
    protected
        string
    $systemType
    
    
    
    
$timeout
    protected
        int
    $timeout
     = 90
    
    
    
Methods
__construct()
Constructor.
    public
                __construct(array<string|int, mixed> $config) : mixed
    
        Parameters
- $config : array<string|int, mixed>
 
Return values
mixed —__destruct()
Disconnect on destruction.
    public
                __destruct() : mixed
    
    
    
        Return values
mixed —applyPathPrefix()
Prefix a path.
    public
                applyPathPrefix(string $path) : string
    
        Parameters
- $path : string
 
Return values
string —prefixed path
connect()
Establish a connection.
    public
    abstract            connect() : mixed
    
    
    
        Return values
mixed —disconnect()
Close the connection.
    public
    abstract            disconnect() : mixed
    
    
    
        Return values
mixed —ensureDirectory()
Ensure a directory exists.
    public
                ensureDirectory(string $dirname) : mixed
    
        Parameters
- $dirname : string
 
Return values
mixed —getConnection()
    public
                getConnection() : mixed
    
    
    
        Return values
mixed —getHost()
Returns the host.
    public
                getHost() : string
    
    
    
        Return values
string —getPassword()
Returns the password.
    public
                getPassword() : string
    
    
    
        Return values
string —password
getPathPrefix()
Get the path prefix.
    public
                getPathPrefix() : string|null
    
    
    
        Return values
string|null —path prefix or null if pathPrefix is empty
getPermPrivate()
Get the private permission value.
    public
                getPermPrivate() : int
    
    
    
        Return values
int —getPermPublic()
Get the public permission value.
    public
                getPermPublic() : int
    
    
    
        Return values
int —getPort()
Returns the ftp port.
    public
                getPort() : int
    
    
    
        Return values
int —getRoot()
Returns the root folder to work from.
    public
                getRoot() : string
    
    
    
        Return values
string —getSize()
    public
                getSize(mixed $path) : mixed
    
        Parameters
- $path : mixed
 
Tags
Return values
mixed —getSystemType()
Return the FTP system type.
    public
                getSystemType() : string
    
    
    
        Return values
string —getTimeout()
Returns the amount of seconds before the connection will timeout.
    public
                getTimeout() : int
    
    
    
        Return values
int —getUsername()
Returns the ftp username.
    public
                getUsername() : string
    
    
    
        Return values
string —username
getVisibility()
    public
                getVisibility(mixed $path) : mixed
    
        Parameters
- $path : mixed
 
Tags
Return values
mixed —has()
    public
                has(mixed $path) : mixed
    
        Parameters
- $path : mixed
 
Tags
Return values
mixed —isConnected()
Check if a connection is active.
    public
    abstract            isConnected() : bool
    
    
    
        Return values
bool —listContents()
    public
                listContents([mixed $directory = '' ][, mixed $recursive = false ]) : mixed
    
        Parameters
- $directory : mixed = ''
 - $recursive : mixed = false
 
Tags
Return values
mixed —removeDotDirectories()
Filter out dot-directories.
    public
                removeDotDirectories(array<string|int, mixed> $list) : array<string|int, mixed>
    
        Parameters
- $list : array<string|int, mixed>
 
Return values
array<string|int, mixed> —removePathPrefix()
Remove a path prefix.
    public
                removePathPrefix(string $path) : string
    
        Parameters
- $path : string
 
Return values
string —path without the prefix
setConfig()
Set the config.
    public
                setConfig(array<string|int, mixed> $config) : $this
    
        Parameters
- $config : array<string|int, mixed>
 
Return values
$this —setEnableTimestampsOnUnixListings()
True to enable timestamps for FTP servers that return unix-style listings.
    public
                setEnableTimestampsOnUnixListings([bool $bool = false ]) : $this
    
        Parameters
- $bool : bool = false
 
Return values
$this —setHost()
Set the host.
    public
                setHost(string $host) : $this
    
        Parameters
- $host : string
 
Return values
$this —setPassword()
Set the ftp password.
    public
                setPassword(string $password) : $this
    
        Parameters
- $password : string
 
Return values
$this —setPathPrefix()
Set the path prefix.
    public
                setPathPrefix(string $prefix) : void
    
        Parameters
- $prefix : string
 
Return values
void —setPermPrivate()
Set the private permission value.
    public
                setPermPrivate(int $permPrivate) : $this
    
        Parameters
- $permPrivate : int
 
Return values
$this —setPermPublic()
Set the public permission value.
    public
                setPermPublic(int $permPublic) : $this
    
        Parameters
- $permPublic : int
 
Return values
$this —setPort()
Set the ftp port.
    public
                setPort(int|string $port) : $this
    
        Parameters
- $port : int|string
 
Return values
$this —setRoot()
Set the root folder to work from.
    public
                setRoot(string $root) : $this
    
        Parameters
- $root : string
 
Return values
$this —setSystemType()
Set the FTP system type (windows or unix).
    public
                setSystemType(string $systemType) : $this
    
        Parameters
- $systemType : string
 
Return values
$this —setTimeout()
Set the amount of seconds before the connection should timeout.
    public
                setTimeout(int $timeout) : $this
    
        Parameters
- $timeout : int
 
Return values
$this —setUsername()
Set ftp username.
    public
                setUsername(string $username) : $this
    
        Parameters
- $username : string
 
Return values
$this —detectSystemType()
Get the system type from a listing item.
    protected
                detectSystemType(string $item) : string
    
        Parameters
- $item : string
 
Return values
string —the system type
detectType()
Get the file type from the permissions.
    protected
                detectType(string $permissions) : string
    
        Parameters
- $permissions : string
 
Return values
string —file type
escapePath()
    protected
                escapePath(mixed $path) : mixed
        
        Parameters
- $path : mixed
 
Return values
mixed —listDirectoryContents()
    protected
    abstract            listDirectoryContents(mixed $directory[, mixed $recursive = false ]) : mixed
        
        Parameters
- $directory : mixed
 - $recursive : mixed = false
 
Return values
mixed —normalizeListing()
Normalize a directory listing.
    protected
                normalizeListing(array<string|int, mixed> $listing[, string $prefix = '' ]) : array<string|int, mixed>
    
        Parameters
- $listing : array<string|int, mixed>
 - $prefix : string = ''
 
Return values
array<string|int, mixed> —directory listing
normalizeObject()
Normalize a file entry.
    protected
                normalizeObject(string $item, string $base) : array<string|int, mixed>
    
        Parameters
- $item : string
 - $base : string
 
Tags
Return values
array<string|int, mixed> —normalized file array
normalizePermissions()
Normalize a permissions string.
    protected
                normalizePermissions(string $permissions) : int
    
        Parameters
- $permissions : string
 
Return values
int —normalizeUnixObject()
Normalize a Unix file entry.
    protected
                normalizeUnixObject(string $item, string $base) : array<string|int, mixed>
        Given $item contains: '-rw-r--r-- 1 ftp ftp 409 Aug 19 09:01 file1.txt'
This function will return: [ 'type' => 'file', 'path' => 'file1.txt', 'visibility' => 'public', 'size' => 409, 'timestamp' => 1566205260 ]
Parameters
- $item : string
 - $base : string
 
Return values
array<string|int, mixed> —normalized file array
normalizeUnixTimestamp()
Only accurate to the minute (current year), or to the day.
    protected
                normalizeUnixTimestamp(string $month, string $day, string $timeOrYear) : int
        Inadequacies in timestamp accuracy are due to limitations of the FTP 'LIST' command
Note: The 'MLSD' command is a machine-readable replacement for 'LIST' but many FTP servers do not support it :(
Parameters
- $month : string
 - 
                    
e.g. 'Aug'
 - $day : string
 - 
                    
e.g. '19'
 - $timeOrYear : string
 - 
                    
e.g. '09:01' OR '2015'
 
Return values
int —normalizeWindowsObject()
Normalize a Windows/DOS file entry.
    protected
                normalizeWindowsObject(string $item, string $base) : array<string|int, mixed>
    
        Parameters
- $item : string
 - $base : string
 
Return values
array<string|int, mixed> —normalized file array
sortListing()
Sort a directory listing.
    protected
                sortListing(array<string|int, mixed> $result) : array<string|int, mixed>
    
        Parameters
- $result : array<string|int, mixed>
 
Return values
array<string|int, mixed> —sorted listing