class FTPService implements ServiceInterface (View source)

Methods

void
__construct(array $config)

FTPService constructor

static 
configure(array $config)

Configure service

void
connect()

Connect to the FTP server.

void
disconnect()

Disconnect from the FTP server.

void
setConnectionRoot(string $path = '')

Set the connection root.

Connection
getConnection()

Get ftp connextion

string
getCurrentDirectory()

Return the current working directory.

mixed
store(UploadFile $file, string $location = null, array $option = [])

Store directly the upload file

bool
append(string $file, string $content)

Append content a file.

bool
prepend(string $file, string $content)

Write to the beginning of a file specify

bool
put(string $file, string $content)

Put other file content in given file

array
files(string $dirname = '.')

List files in a directory

array
directories(string $dirname = '.')

List directories

bool
makeDirectory(string $dirname, int $mode = 0777)

Create a directory

bool
makeActualDirectory(string $directory)

Create a directory.

null|string
get(string $filename)

Get file content

bool
copy(string $target, string $source)

Copy the contents of a source file to a target file.

move(string $target, string $source)

Rename or move a source file to a target file.

bool
exists(string $filename)

Check that a file exists

bool
isFile(string $filename)

isFile alias of is_file.

bool
isDirectory(string $dirname)

isDirectory alias of is_dir.

string
path(string $filename)

Resolves a path.

bool
delete(string $file)

Delete file

array
listDirectoryContents(string $directory = '.')

List the directory content

Details

void __construct(array $config)

FTPService constructor

Parameters

array $config

Return Value

void

static configure(array $config)

Configure service

Parameters

array $config

void connect()

Connect to the FTP server.

Return Value

void

void disconnect()

Disconnect from the FTP server.

Return Value

void

void setConnectionRoot(string $path = '')

Set the connection root.

Parameters

string $path

Return Value

void

Connection getConnection()

Get ftp connextion

Return Value

Connection

string getCurrentDirectory()

Return the current working directory.

Return Value

string

mixed store(UploadFile $file, string $location = null, array $option = [])

Store directly the upload file

Parameters

UploadFile $file
string $location
array $option

Return Value

mixed

Exceptions

InvalidArgumentException

bool append(string $file, string $content)

Append content a file.

Parameters

string $file
string $content

Return Value

bool

bool prepend(string $file, string $content)

Write to the beginning of a file specify

Parameters

string $file
string $content

Return Value

bool

Exceptions

bool put(string $file, string $content)

Put other file content in given file

Parameters

string $file
string $content

Return Value

bool

array files(string $dirname = '.')

List files in a directory

Parameters

string $dirname

Return Value

array

array directories(string $dirname = '.')

List directories

Parameters

string $dirname

Return Value

array

bool makeDirectory(string $dirname, int $mode = 0777)

Create a directory

Parameters

string $dirname
int $mode

Return Value

bool

protected bool makeActualDirectory(string $directory)

Create a directory.

Parameters

string $directory

Return Value

bool

null|string get(string $filename)

Get file content

Parameters

string $filename

Return Value

null|string

bool copy(string $target, string $source)

Copy the contents of a source file to a target file.

Parameters

string $target
string $source

Return Value

bool

move(string $target, string $source)

Rename or move a source file to a target file.

Parameters

string $target
string $source

bool exists(string $filename)

Check that a file exists

Parameters

string $filename

Return Value

bool

bool isFile(string $filename)

isFile alias of is_file.

Parameters

string $filename

Return Value

bool

bool isDirectory(string $dirname)

isDirectory alias of is_dir.

Parameters

string $dirname

Return Value

bool

string path(string $filename)

Resolves a path.

Give the absolute path of a path

Parameters

string $filename

Return Value

string

bool delete(string $file)

Delete file

Parameters

string $file

Return Value

bool

protected array listDirectoryContents(string $directory = '.')

List the directory content

Parameters

string $directory

Return Value

array