PHP Класс org\bovigo\vfs\vfsStreamWrapper

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

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

Свойство Тип Описание
$content shortcut to file container
$dir shortcut to directory container
$dirIterator shortcut to directory container iterator
$mode file mode: read only, write only, all
$registered switch whether class has already been registered as stream wrapper or not
$root root content

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

Метод Описание
dir_closedir ( ) : boolean closes directory
dir_opendir ( string $path, integer $options ) : boolean opens a directory
dir_readdir ( ) : string reads directory contents
dir_rewinddir ( ) : boolean reset directory iteration
getRoot ( ) : org\bovigo\vfs\vfsStreamContainer returns the root content
mkdir ( string $path, integer $mode, integer $options ) : boolean creates a new directory
register ( ) method to register the stream wrapper
rename ( string $path_from, string $path_to ) : boolean rename from one path to another
rmdir ( string $path, integer $options ) : boolean removes a directory
setQuota ( Quota $quota ) sets quota for disk space
setRoot ( org\bovigo\vfs\vfsStreamContainer $root ) : org\bovigo\vfs\vfsStreamContainer sets the root content
stream_cast ( integer $cast_as ) : boolean retrieve the underlaying resource
stream_close ( ) closes the stream
stream_eof ( ) : boolean checks whether stream is at end of file
stream_flush ( ) : boolean flushes unstored data into storage
stream_lock ( integer $operation ) : boolean set lock status for stream
stream_metadata ( string $path, integer $option, mixed $var ) : boolean sets metadata like owner, user or permissions
stream_open ( string $path, string $mode, string $options, string $opened_path ) : boolean open the stream
stream_read ( integer $count ) : string read the stream up to $count bytes
stream_seek ( integer $offset, integer $whence ) : boolean seeks to the given offset
stream_set_option ( integer $option, integer $arg1, integer $arg2 ) : boolean sets options on the stream
stream_stat ( ) : array returns status of stream
stream_tell ( ) : integer returns the current position of the stream
stream_truncate ( integer $size ) : boolean truncates a file to a given length
stream_write ( string $data ) : integer writes data into the stream
unlink ( string $path ) : boolean remove the data under the given path
unregister ( ) Unregisters a previously registered URL wrapper for the vfs scheme.
url_stat ( string $path, integer $flags ) : array returns status of url

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

Метод Описание
calculateMode ( string $mode, boolean $extended ) : integer calculates the file mode
doUnlink ( string $path ) : boolean removes a path
getContent ( string $path ) : org\bovigo\vfs\vfsStreamContent returns content for given path
getContentOfType ( string $path, integer $type ) : org\bovigo\vfs\vfsStreamContent returns content for given path but only when it is of given type
resolvePath ( string $path ) : string helper method to resolve a path from /foo/bar/. to /foo/bar
splitPath ( string $path ) : string[] splits path into its dirname and the basename

Приватные методы

Метод Описание
createFile ( string $path, string $mode = null, string $options = null ) : boolean creates a file at given path
doPermChange ( string $path, vfsStreamAbstractContent $content, Closure $change ) : boolean executes given permission change when necessary rights allow such a change
isInRoot ( string $path ) : boolean helper method to detect whether given path is in root path

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

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

calculates the file mode
protected calculateMode ( string $mode, boolean $extended ) : integer
$mode string opening mode: r, w, a or x
$extended boolean true if + was set with opening mode
Результат integer

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

closes directory
public dir_closedir ( ) : boolean
Результат boolean

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

opens a directory
public dir_opendir ( string $path, integer $options ) : boolean
$path string
$options integer
Результат boolean

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

reads directory contents
public dir_readdir ( ) : string
Результат string

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

reset directory iteration
public dir_rewinddir ( ) : boolean
Результат boolean

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

returns content for given path
protected getContent ( string $path ) : org\bovigo\vfs\vfsStreamContent
$path string
Результат org\bovigo\vfs\vfsStreamContent

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

returns content for given path but only when it is of given type
protected getContentOfType ( string $path, integer $type ) : org\bovigo\vfs\vfsStreamContent
$path string
$type integer
Результат org\bovigo\vfs\vfsStreamContent

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

returns the root content
public static getRoot ( ) : org\bovigo\vfs\vfsStreamContainer
Результат org\bovigo\vfs\vfsStreamContainer

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

creates a new directory
public mkdir ( string $path, integer $mode, integer $options ) : boolean
$path string
$mode integer
$options integer
Результат boolean

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

Please be aware that a call to this method will reset the root element to null. If the stream is already registered the method returns silently. If there is already another stream wrapper registered for the scheme used by vfsStream a vfsStreamException will be thrown.
public static register ( )

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

rename from one path to another
Автор: Benoit Aubuchon
public rename ( string $path_from, string $path_to ) : boolean
$path_from string
$path_to string
Результат boolean

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

helper method to resolve a path from /foo/bar/. to /foo/bar
protected resolvePath ( string $path ) : string
$path string
Результат string

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

removes a directory
public rmdir ( string $path, integer $options ) : boolean
$path string
$options integer
Результат boolean

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

sets quota for disk space
С версии: 1.1.0
public static setQuota ( Quota $quota )
$quota Quota

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

sets the root content
public static setRoot ( org\bovigo\vfs\vfsStreamContainer $root ) : org\bovigo\vfs\vfsStreamContainer
$root org\bovigo\vfs\vfsStreamContainer
Результат org\bovigo\vfs\vfsStreamContainer

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

splits path into its dirname and the basename
protected splitPath ( string $path ) : string[]
$path string
Результат string[]

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

Please note that this method always returns false as there is no underlaying resource to return.
См. также: https://github.com/mikey179/vfsStream/issues/3
С версии: 0.9.0
public stream_cast ( integer $cast_as ) : boolean
$cast_as integer
Результат boolean

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

closes the stream
См. также: https://github.com/mikey179/vfsStream/issues/40
public stream_close ( )

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

checks whether stream is at end of file
public stream_eof ( ) : boolean
Результат boolean

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

flushes unstored data into storage
public stream_flush ( ) : boolean
Результат boolean

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

set lock status for stream
См. также: https://github.com/mikey179/vfsStream/issues/6
См. также: https://github.com/mikey179/vfsStream/issues/31
См. также: https://github.com/mikey179/vfsStream/issues/40
С версии: 0.10.0
public stream_lock ( integer $operation ) : boolean
$operation integer
Результат boolean

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

sets metadata like owner, user or permissions
С версии: 1.1.0
public stream_metadata ( string $path, integer $option, mixed $var ) : boolean
$path string
$option integer
$var mixed
Результат boolean

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

open the stream
public stream_open ( string $path, string $mode, string $options, string $opened_path ) : boolean
$path string the path to open
$mode string mode for opening
$options string options for opening
$opened_path string full path that was actually opened
Результат boolean

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

read the stream up to $count bytes
public stream_read ( integer $count ) : string
$count integer amount of bytes to read
Результат string

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

seeks to the given offset
public stream_seek ( integer $offset, integer $whence ) : boolean
$offset integer
$whence integer
Результат boolean

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

sets options on the stream
См. также: https://github.com/mikey179/vfsStream/issues/15
См. также: http://www.php.net/manual/streamwrapper.stream-set-option.php
С версии: 0.10.0
public stream_set_option ( integer $option, integer $arg1, integer $arg2 ) : boolean
$option integer key of option to set
$arg1 integer
$arg2 integer
Результат boolean

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

returns status of stream
public stream_stat ( ) : array
Результат array

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

returns the current position of the stream
public stream_tell ( ) : integer
Результат integer

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

truncates a file to a given length
С версии: 1.1.0
public stream_truncate ( integer $size ) : boolean
$size integer length to truncate file to
Результат boolean

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

writes data into the stream
public stream_write ( string $data ) : integer
$data string
Результат integer amount of bytes written

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

If this stream wrapper wasn't registered, the method returns silently. If unregistering fails, or if the URL wrapper for vfs:// was not registered with this class, a vfsStreamException will be thrown.
С версии: 1.6.0
public static unregister ( )

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

returns status of url
public url_stat ( string $path, integer $flags ) : array
$path string path of url to return status for
$flags integer flags set by the stream API
Результат array

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

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

shortcut to file container
protected $content

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

shortcut to directory container
protected $dir

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

shortcut to directory container iterator
protected $dirIterator

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

file mode: read only, write only, all
protected $mode

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

switch whether class has already been registered as stream wrapper or not
protected static $registered

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

root content
protected static $root