PHP Класс Jyxo\Webdav\Client

Автор: Jaroslav Hanslík
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$createDirectoriesAutomatically boolean If disabled, commands will throw an error if target directory doesn't exist.
$logger Jyxo\Webdav\LoggerInterface Logger.
$parallelSending boolean If parallel request sending is enabled.
$requestOptions array Request options.
$servers array Servers list.

Открытые методы

Метод Описание
__construct ( array $servers ) Constructor.
copy ( string $pathFrom, string $pathTo ) Copies a file.
exists ( string $path ) : boolean Checks if a file exists.
get ( string $path ) : string Returns file contents.
getProperty ( string $path, string $property = null ) : mixed Returns a file property.
isDir ( string $dir ) : boolean Checks if a directory exists.
mkdir ( string $dir, boolean $recursive = true ) Creates a directory.
put ( string $path, string $data ) Saves data to a remote file.
putFile ( string $path, string $file ) Saves file contents to a remote file.
rename ( string $pathFrom, string $pathTo ) Renames a file.
rmdir ( string $dir ) Deletes a directory.
setCreateDirectoriesAutomatically ( boolean $createDirectoriesAutomatically ) : self Enables/disables automatic creation of target directories.
setLogger ( Jyxo\Webdav\LoggerInterface $logger ) : self Sets a logger.
setParallelSending ( boolean $parallelSending ) : self Enables/disables parallel request sending.
setRequestOption ( string $name, mixed $value ) : self Sets a request option.
unlink ( string $path ) Deletes a file.

Защищенные методы

Метод Описание
createAllRequests ( string $path, string $method, array $headers = [], string | resource | null $body = null ) : array Creates a list of requests; one for each server.
createClient ( ) : Client
createRequest ( string $server, string $path, string $method, array $headers = [], string | resource | null $body = null ) : GuzzleHttp\Psr7\Request Creates a request.
getDirPath ( string $path ) : string Creates a directory path with the trailing slash.
getFilePath ( string $path ) : string Creates a file path without the trailing slash.
getProperties ( Response $response ) : array Fetches properties from the response.
getRandomServer ( ) : string
processPut ( string $path, string $data, boolean $isFile ) Processes a PUT request.
sendAllRequests ( array $requests ) : array Sends requests to all servers.
sendRequest ( string $path, string $method, array $headers = [] ) : Response Sends a request.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( array $servers )
$servers array

copy() публичный Метод

Does not work on Lighttpd.
public copy ( string $pathFrom, string $pathTo )
$pathFrom string Source file path
$pathTo string Target file path

createAllRequests() защищенный Метод

Creates a list of requests; one for each server.
protected createAllRequests ( string $path, string $method, array $headers = [], string | resource | null $body = null ) : array
$path string Request path
$method string Request method
$headers array Array of headers
$body string | resource | null Request body
Результат array

createClient() защищенный Метод

protected createClient ( ) : Client
Результат GuzzleHttp\Client

createRequest() защищенный Метод

Creates a request.
protected createRequest ( string $server, string $path, string $method, array $headers = [], string | resource | null $body = null ) : GuzzleHttp\Psr7\Request
$server string Server
$path string Path
$method string Request method
$headers array Array of headers
$body string | resource | null Request body
Результат GuzzleHttp\Psr7\Request

exists() публичный Метод

Checks if a file exists.
public exists ( string $path ) : boolean
$path string File path
Результат boolean

get() публичный Метод

Returns file contents.
public get ( string $path ) : string
$path string File path
Результат string

getDirPath() защищенный Метод

Creates a directory path with the trailing slash.
protected getDirPath ( string $path ) : string
$path string Directory path
Результат string

getFilePath() защищенный Метод

Creates a file path without the trailing slash.
protected getFilePath ( string $path ) : string
$path string File path
Результат string

getProperties() защищенный Метод

Fetches properties from the response.
protected getProperties ( Response $response ) : array
$response GuzzleHttp\Psr7\Response Response
Результат array

getProperty() публичный Метод

If no particular property is set, all properties are returned.
public getProperty ( string $path, string $property = null ) : mixed
$path string File path
$property string Property name
Результат mixed

getRandomServer() защищенный Метод

protected getRandomServer ( ) : string
Результат string

isDir() публичный Метод

Checks if a directory exists.
public isDir ( string $dir ) : boolean
$dir string Directory path
Результат boolean

mkdir() публичный Метод

Creates a directory.
public mkdir ( string $dir, boolean $recursive = true )
$dir string Directory path
$recursive boolean Create directories recursively?

processPut() защищенный Метод

Processes a PUT request.
protected processPut ( string $path, string $data, boolean $isFile )
$path string File path
$data string Data
$isFile boolean Determines if $data is a file name or actual data

put() публичный Метод

Saves data to a remote file.
public put ( string $path, string $data )
$path string File path
$data string Data

putFile() публичный Метод

Saves file contents to a remote file.
public putFile ( string $path, string $file )
$path string File path
$file string Local file path

rename() публичный Метод

Does not work on Lighttpd.
public rename ( string $pathFrom, string $pathTo )
$pathFrom string Original file name
$pathTo string New file name

rmdir() публичный Метод

Deletes a directory.
public rmdir ( string $dir )
$dir string Directory path

sendAllRequests() защищенный Метод

Sends requests to all servers.
protected sendAllRequests ( array $requests ) : array
$requests array Request list
Результат array

sendRequest() защищенный Метод

Sends a request.
protected sendRequest ( string $path, string $method, array $headers = [] ) : Response
$path string Request path
$method string Request method
$headers array Array of headers
Результат GuzzleHttp\Psr7\Response

setCreateDirectoriesAutomatically() публичный Метод

Enables/disables automatic creation of target directories.
public setCreateDirectoriesAutomatically ( boolean $createDirectoriesAutomatically ) : self
$createDirectoriesAutomatically boolean
Результат self

setLogger() публичный Метод

Sets a logger.
public setLogger ( Jyxo\Webdav\LoggerInterface $logger ) : self
$logger Jyxo\Webdav\LoggerInterface Logger
Результат self

setParallelSending() публичный Метод

Enables/disables parallel request sending.
public setParallelSending ( boolean $parallelSending ) : self
$parallelSending boolean
Результат self

setRequestOption() публичный Метод

Sets a request option.
См. также: GuzzleHttp\RequestOptions
public setRequestOption ( string $name, mixed $value ) : self
$name string Option name
$value mixed Option value
Результат self

Описание свойств

$createDirectoriesAutomatically защищенное свойство

If disabled, commands will throw an error if target directory doesn't exist.
protected bool $createDirectoriesAutomatically
Результат boolean

$logger защищенное свойство

Logger.
protected LoggerInterface,Jyxo\Webdav $logger
Результат Jyxo\Webdav\LoggerInterface

$parallelSending защищенное свойство

If parallel request sending is enabled.
protected bool $parallelSending
Результат boolean

$requestOptions защищенное свойство

Request options.
protected array $requestOptions
Результат array

$servers защищенное свойство

Servers list.
protected array $servers
Результат array