PHP Класс TQ\Vcs\StreamWrapper\AbstractStreamWrapper

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$context resource The stream context if set

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

Свойство Тип Описание
$bufferFactory TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface The buffer factory
$contextOptions array The parsed stream context options
$contextParameters array The parsed stream context parameters
$dirBuffer TQ\Vcs\Buffer\ArrayBuffer The directory buffer if used on a directory
$fileBuffer TQ\Vcs\Buffer\FileBufferInterface The file buffer if used on a file
$path TQ\Vcs\StreamWrapper\PathInformationInterface The opened path
$pathFactory PathFactoryInterface The path factory
$protocol string The registered protocol

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

Метод Описание
dir_closedir ( ) : boolean streamWrapper::dir_closedir — Close directory handle
dir_opendir ( string $path, integer $options ) : boolean streamWrapper::dir_opendir — Open directory handle
dir_readdir ( ) : string | false streamWrapper::dir_readdir — Read entry from directory handle
dir_rewinddir ( ) : boolean streamWrapper::dir_rewinddir — Rewind directory handle
getRepositoryRegistry ( ) : RepositoryRegistry Returns the repository registry
mkdir ( string $path, integer $mode, integer $options ) : boolean streamWrapper::mkdir — Create a directory
rename ( string $path_from, string $path_to ) : boolean streamWrapper::rename — Renames a file or directory
rmdir ( string $path, integer $options ) : boolean streamWrapper::rmdir — Removes a directory
stream_close ( ) streamWrapper::stream_close — Close an resource
stream_eof ( ) : boolean streamWrapper::stream_eof — Tests for end-of-file on a file pointer
stream_flush ( ) : boolean streamWrapper::stream_flush — Flushes the output
stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean streamWrapper::stream_open — Opens file or URL
stream_read ( integer $count ) : string streamWrapper::stream_read — Read from stream
stream_seek ( integer $offset, integer $whence = SEEK_SET ) : boolean streamWrapper::stream_seek — Seeks to specific location in a stream
stream_stat ( ) : array streamWrapper::stream_stat — Retrieve information about a file resource
stream_tell ( ) : integer streamWrapper::stream_tell — Retrieve the current position of a stream
stream_write ( string $data ) : integer streamWrapper::stream_write — Write to stream
unlink ( string $path ) : boolean streamWrapper::unlink — Delete a file
unregister ( ) Unregisters the stream wrapper
url_stat ( string $path, integer $flags ) : array streamWrapper::url_stat — Retrieve information about a file

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

Метод Описание
doRegister ( string $protocol, PathFactoryInterface $pathFactory, TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface $bufferFactory ) Registers the stream wrapper with the given protocol
getBufferFactory ( ) : TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface Creates the buffer factory
getContextOption ( string $option, mixed $default = null ) : mixed Returns a context option - $default if option is not found
getContextOptions ( boolean $all = false ) : array Parses the passed stream context and returns the context options relevant for this stream wrapper
getContextParameter ( string $parameter, mixed $default = null ) : mixed Returns a context parameter - $default if parameter is not found
getContextParameters ( ) : array Parses the passed stream context and returns the context parameters
getPath ( string $streamUrl ) : TQ\Vcs\StreamWrapper\PathInformationInterface Returns the path information for a given stream URL
maskHasFlag ( integer $mask, integer $flag ) : boolean Checks if a bitmask has a specific flag set

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

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

streamWrapper::dir_closedir — Close directory handle
public dir_closedir ( ) : boolean
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::dir_opendir — Open directory handle
public dir_opendir ( string $path, integer $options ) : boolean
$path string Specifies the URL that was passed to {@see \opendir()}.
$options integer Whether or not to enforce safe_mode (0x04).
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::dir_readdir — Read entry from directory handle
public dir_readdir ( ) : string | false
Результат string | false Should return string representing the next filename, or FALSE if there is no next file.

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

streamWrapper::dir_rewinddir — Rewind directory handle
public dir_rewinddir ( ) : boolean
Результат boolean Returns TRUE on success or FALSE on failure.

doRegister() защищенный статический Метод

Registers the stream wrapper with the given protocol
protected static doRegister ( string $protocol, PathFactoryInterface $pathFactory, TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface $bufferFactory )
$protocol string The protocol (such as "vcs")
$pathFactory PathFactoryInterface The path factory
$bufferFactory TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface The buffer factory

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

Creates the buffer factory
protected getBufferFactory ( ) : TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface
Результат TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface

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

Returns a context option - $default if option is not found
protected getContextOption ( string $option, mixed $default = null ) : mixed
$option string The option to retrieve
$default mixed The default value if $option is not found
Результат mixed

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

Parses the passed stream context and returns the context options relevant for this stream wrapper
protected getContextOptions ( boolean $all = false ) : array
$all boolean Return all options instead of just the relevant options
Результат array The context options

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

Returns a context parameter - $default if parameter is not found
protected getContextParameter ( string $parameter, mixed $default = null ) : mixed
$parameter string The parameter to retrieve
$default mixed The default value if $parameter is not found
Результат mixed

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

Parses the passed stream context and returns the context parameters
protected getContextParameters ( ) : array
Результат array The context parameters

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

Returns the path information for a given stream URL
protected getPath ( string $streamUrl ) : TQ\Vcs\StreamWrapper\PathInformationInterface
$streamUrl string The URL given to the stream function
Результат TQ\Vcs\StreamWrapper\PathInformationInterface The path information representing the stream URL

getRepositoryRegistry() публичный статический Метод

Returns the repository registry
public static getRepositoryRegistry ( ) : RepositoryRegistry
Результат RepositoryRegistry

maskHasFlag() защищенный статический Метод

Checks if a bitmask has a specific flag set
protected static maskHasFlag ( integer $mask, integer $flag ) : boolean
$mask integer The bitmask
$flag integer The flag to check
Результат boolean

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

streamWrapper::mkdir — Create a directory
public mkdir ( string $path, integer $mode, integer $options ) : boolean
$path string Directory which should be created.
$mode integer The value passed to {@see \mkdir()}.
$options integer A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::rename — Renames a file or directory
public rename ( string $path_from, string $path_to ) : boolean
$path_from string The URL to the current file.
$path_to string The URL which the $path_from should be renamed to.
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::rmdir — Removes a directory
public rmdir ( string $path, integer $options ) : boolean
$path string The directory URL which should be removed.
$options integer A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::stream_close — Close an resource
public stream_close ( )

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

streamWrapper::stream_eof — Tests for end-of-file on a file pointer
public stream_eof ( ) : boolean
Результат boolean Should return TRUE if the read/write position is at the end of the stream and if no more data is available to be read, or FALSE otherwise.

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

streamWrapper::stream_flush — Flushes the output
public stream_flush ( ) : boolean
Результат boolean Should return TRUE if the cached data was successfully stored (or if there was no data to store), or FALSE if the data could not be stored.

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

streamWrapper::stream_open — Opens file or URL
public stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean
$path string Specifies the URL that was passed to the original function.
$mode string The mode used to open the file, as detailed for fopen().
$options integer Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together. STREAM_USE_PATH If path is relative, search for the resource using the include_path. STREAM_REPORT_ERRORS If this flag is set, you are responsible for raising errors using trigger_error() during opening of the stream. If this flag is not set, you should not raise any errors.
$opened_path string If the path is opened successfully, and STREAM_USE_PATH is set in options, opened_path should be set to the full path of the file/resource that was actually opened.
Результат boolean Returns TRUE on success or FALSE on failure.

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

streamWrapper::stream_read — Read from stream
public stream_read ( integer $count ) : string
$count integer How many bytes of data from the current position should be returned.
Результат string If there are less than count bytes available, return as many as are available. If no more data is available, return either FALSE or an empty string.

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

streamWrapper::stream_seek — Seeks to specific location in a stream
public stream_seek ( integer $offset, integer $whence = SEEK_SET ) : boolean
$offset integer The stream offset to seek to.
$whence integer Possible values: SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset.
Результат boolean Return TRUE if the position was updated, FALSE otherwise.

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

streamWrapper::stream_stat — Retrieve information about a file resource
public stream_stat ( ) : array
Результат array stat() and fstat() result format Numeric Associative (since PHP 4.0.6) Description 0 dev device number 1 ino inode number * 2 mode inode protection mode 3 nlink number of links 4 uid userid of owner * 5 gid groupid of owner * 6 rdev device type, if inode device 7 size size in bytes 8 atime time of last access (Unix timestamp) 9 mtime time of last modification (Unix timestamp) 10 ctime time of last inode change (Unix timestamp) 11 blksize blocksize of filesystem IO ** 12 blocks number of 512-byte blocks allocated ** * On Windows this will always be 0. ** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1.

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

streamWrapper::stream_tell — Retrieve the current position of a stream
public stream_tell ( ) : integer
Результат integer Should return the current position of the stream.

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

streamWrapper::stream_write — Write to stream
public stream_write ( string $data ) : integer
$data string Should be stored into the underlying stream.
Результат integer Should return the number of bytes that were successfully stored, or 0 if none could be stored.

unregister() публичный статический Метод

Unregisters the stream wrapper
public static unregister ( )

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

mode bit mask: S_IFMT 0170000 bit mask for the file type bit fields S_IFSOCK 0140000 socket S_IFLNK 0120000 symbolic link S_IFREG 0100000 regular file S_IFBLK 0060000 block device S_IFDIR 0040000 directory S_IFCHR 0020000 character device S_IFIFO 0010000 FIFO S_ISUID 0004000 set UID bit S_ISGID 0002000 set-group-ID bit (see below) S_ISVTX 0001000 sticky bit (see below) S_IRWXU 00700 mask for file owner permissions S_IRUSR 00400 owner has read permission S_IWUSR 00200 owner has write permission S_IXUSR 00100 owner has execute permission S_IRWXG 00070 mask for group permissions S_IRGRP 00040 group has read permission S_IWGRP 00020 group has write permission S_IXGRP 00010 group has execute permission S_IRWXO 00007 mask for permissions for others (not in group) S_IROTH 00004 others have read permission S_IWOTH 00002 others have write permission S_IXOTH 00001 others have execute permission
public url_stat ( string $path, integer $flags ) : array
$path string The file path or URL to stat. Note that in the case of a URL, it must be a :// delimited URL. Other URL forms are not supported.
$flags integer Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together. STREAM_URL_STAT_LINK For resources with the ability to link to other resource (such as an HTTP Location: forward, or a filesystem symlink). This flag specified that only information about the link itself should be returned, not the resource pointed to by the link. This flag is set in response to calls to lstat(), is_link(), or filetype(). STREAM_URL_STAT_QUIET If this flag is set, your wrapper should not raise any errors. If this flag is not set, you are responsible for reporting errors using the trigger_error() function during stating of the path.
Результат array Should return as many elements as stat() does. Unknown or unavailable values should be set to a rational value (usually 0).

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

$bufferFactory защищенное статическое свойство

The buffer factory
protected static FactoryInterface,TQ\Vcs\StreamWrapper\FileBuffer $bufferFactory
Результат TQ\Vcs\StreamWrapper\FileBuffer\FactoryInterface

$context публичное свойство

The stream context if set
public resource $context
Результат resource

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

The parsed stream context options
protected array $contextOptions
Результат array

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

The parsed stream context parameters
protected array $contextParameters
Результат array

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

The directory buffer if used on a directory
protected ArrayBuffer,TQ\Vcs\Buffer $dirBuffer
Результат TQ\Vcs\Buffer\ArrayBuffer

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

The file buffer if used on a file
protected FileBufferInterface,TQ\Vcs\Buffer $fileBuffer
Результат TQ\Vcs\Buffer\FileBufferInterface

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

The opened path
protected PathInformationInterface,TQ\Vcs\StreamWrapper $path
Результат TQ\Vcs\StreamWrapper\PathInformationInterface

$pathFactory защищенное статическое свойство

The path factory
protected static PathFactoryInterface $pathFactory
Результат PathFactoryInterface

$protocol защищенное статическое свойство

The registered protocol
protected static string $protocol
Результат string