PHP Class org\bovigo\vfs\vfsStreamWrapper

Afficher le fichier Open project: mikey179/vfsstream Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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

Private Methods

Méthode Description
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

Method Details

calculateMode() protected méthode

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
Résultat integer

dir_closedir() public méthode

closes directory
public dir_closedir ( ) : boolean
Résultat boolean

dir_opendir() public méthode

opens a directory
public dir_opendir ( string $path, integer $options ) : boolean
$path string
$options integer
Résultat boolean

dir_readdir() public méthode

reads directory contents
public dir_readdir ( ) : string
Résultat string

dir_rewinddir() public méthode

reset directory iteration
public dir_rewinddir ( ) : boolean
Résultat boolean

getContent() protected méthode

returns content for given path
protected getContent ( string $path ) : org\bovigo\vfs\vfsStreamContent
$path string
Résultat org\bovigo\vfs\vfsStreamContent

getContentOfType() protected méthode

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
Résultat org\bovigo\vfs\vfsStreamContent

getRoot() public static méthode

returns the root content
public static getRoot ( ) : org\bovigo\vfs\vfsStreamContainer
Résultat org\bovigo\vfs\vfsStreamContainer

mkdir() public méthode

creates a new directory
public mkdir ( string $path, integer $mode, integer $options ) : boolean
$path string
$mode integer
$options integer
Résultat boolean

register() public static méthode

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() public méthode

rename from one path to another
Author: Benoit Aubuchon
public rename ( string $path_from, string $path_to ) : boolean
$path_from string
$path_to string
Résultat boolean

resolvePath() protected méthode

helper method to resolve a path from /foo/bar/. to /foo/bar
protected resolvePath ( string $path ) : string
$path string
Résultat string

rmdir() public méthode

removes a directory
public rmdir ( string $path, integer $options ) : boolean
$path string
$options integer
Résultat boolean

setQuota() public static méthode

sets quota for disk space
Since: 1.1.0
public static setQuota ( Quota $quota )
$quota Quota

setRoot() public static méthode

sets the root content
public static setRoot ( org\bovigo\vfs\vfsStreamContainer $root ) : org\bovigo\vfs\vfsStreamContainer
$root org\bovigo\vfs\vfsStreamContainer
Résultat org\bovigo\vfs\vfsStreamContainer

splitPath() protected méthode

splits path into its dirname and the basename
protected splitPath ( string $path ) : string[]
$path string
Résultat string[]

stream_cast() public méthode

Please note that this method always returns false as there is no underlaying resource to return.
See also: https://github.com/mikey179/vfsStream/issues/3
Since: 0.9.0
public stream_cast ( integer $cast_as ) : boolean
$cast_as integer
Résultat boolean

stream_close() public méthode

closes the stream
See also: https://github.com/mikey179/vfsStream/issues/40
public stream_close ( )

stream_eof() public méthode

checks whether stream is at end of file
public stream_eof ( ) : boolean
Résultat boolean

stream_flush() public méthode

flushes unstored data into storage
public stream_flush ( ) : boolean
Résultat boolean

stream_lock() public méthode

set lock status for stream
See also: https://github.com/mikey179/vfsStream/issues/6
See also: https://github.com/mikey179/vfsStream/issues/31
See also: https://github.com/mikey179/vfsStream/issues/40
Since: 0.10.0
public stream_lock ( integer $operation ) : boolean
$operation integer
Résultat boolean

stream_metadata() public méthode

sets metadata like owner, user or permissions
Since: 1.1.0
public stream_metadata ( string $path, integer $option, mixed $var ) : boolean
$path string
$option integer
$var mixed
Résultat boolean

stream_open() public méthode

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
Résultat boolean

stream_read() public méthode

read the stream up to $count bytes
public stream_read ( integer $count ) : string
$count integer amount of bytes to read
Résultat string

stream_seek() public méthode

seeks to the given offset
public stream_seek ( integer $offset, integer $whence ) : boolean
$offset integer
$whence integer
Résultat boolean

stream_set_option() public méthode

sets options on the stream
See also: https://github.com/mikey179/vfsStream/issues/15
See also: http://www.php.net/manual/streamwrapper.stream-set-option.php
Since: 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
Résultat boolean

stream_stat() public méthode

returns status of stream
public stream_stat ( ) : array
Résultat array

stream_tell() public méthode

returns the current position of the stream
public stream_tell ( ) : integer
Résultat integer

stream_truncate() public méthode

truncates a file to a given length
Since: 1.1.0
public stream_truncate ( integer $size ) : boolean
$size integer length to truncate file to
Résultat boolean

stream_write() public méthode

writes data into the stream
public stream_write ( string $data ) : integer
$data string
Résultat integer amount of bytes written

unregister() public static méthode

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.
Since: 1.6.0
public static unregister ( )

url_stat() public méthode

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
Résultat array

Property Details

$content protected_oe property

shortcut to file container
protected $content

$dir protected_oe property

shortcut to directory container
protected $dir

$dirIterator protected_oe property

shortcut to directory container iterator
protected $dirIterator

$mode protected_oe property

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

$registered protected_oe static_oe property

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

$root protected_oe static_oe property

root content
protected static $root