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

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

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

Свойство Тип Описание
$umask initial umask setting

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

Метод Описание
copyFromFileSystem ( string $path, vfsStreamDirectory $baseDir = null, integer $maxFileSize = 1048576 ) : vfsStreamDirectory copies the file system structure from given path into the base dir
create ( array $structure, vfsStreamDirectory $baseDir = null ) : vfsStreamDirectory creates vfsStream directory structure from an array and adds it to given base dir
disableDotfiles ( ) disable dotfiles in directory listings
enableDotfiles ( ) enable dotfiles in directory listings
getCurrentGroup ( ) : integer returns current group
getCurrentUser ( ) : integer returns current user
inspect ( org\bovigo\vfs\visitor\vfsStreamVisitor $visitor, org\bovigo\vfs\vfsStreamContent $content = null ) : org\bovigo\vfs\visitor\vfsStreamVisitor use visitor to inspect a content structure
newBlock ( string $name, integer $permissions = null ) : org\bovigo\vfs\vfsStreamBlock returns a new block with the given name
newDirectory ( string $name, integer $permissions = null ) : vfsStreamDirectory returns a new directory with given name
newFile ( string $name, integer $permissions = null ) : org\bovigo\vfs\vfsStreamFile returns a new file with given name
path ( string $url ) : string restores the path from the url
setQuota ( integer $bytes ) sets quota to given amount of bytes
setup ( string $rootDirName = 'root', integer $permissions = null, array $structure = [] ) : vfsStreamDirectory helper method for setting up vfsStream in unit tests
umask ( integer $umask = null ) : integer sets new umask setting and returns previous umask setting
url ( string $path ) : string prepends the scheme to the given URL
useDotfiles ( ) : boolean checks if vfsStream lists dotfiles in directory listings

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

Метод Описание
addStructure ( array $structure, vfsStreamDirectory $baseDir ) : vfsStreamDirectory helper method to create subdirectories recursively

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

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

helper method to create subdirectories recursively
protected static addStructure ( array $structure, vfsStreamDirectory $baseDir ) : vfsStreamDirectory
$structure array subdirectory structure to add
$baseDir vfsStreamDirectory directory to add the structure to
Результат vfsStreamDirectory

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

If no baseDir is given it will try to add the structure to the existing root directory without replacing existing childs except those with equal names. File permissions are copied as well. Please note that file contents will only be copied if their file size does not exceed the given $maxFileSize which defaults to 1024 KB. In case the file is larger file content will be mocked, see https://github.com/mikey179/vfsStream/wiki/MockingLargeFiles.
См. также: https://github.com/mikey179/vfsStream/issues/4
С версии: 0.11.0
public static copyFromFileSystem ( string $path, vfsStreamDirectory $baseDir = null, integer $maxFileSize = 1048576 ) : vfsStreamDirectory
$path string path to copy the structure from
$baseDir vfsStreamDirectory directory to add the structure to
$maxFileSize integer maximum file size of files to copy content from
Результат vfsStreamDirectory

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

Assumed $structure contains an array like this: array('Core' = array('AbstractFactory' => array('test.php' => 'some text content', 'other.php' => 'Some more text content', 'Invalid.csv' => 'Something else', ), 'AnEmptyFolder' => array(), 'badlocation.php' => 'some bad content', ) ) the resulting directory tree will look like this:
baseDir
\- Core
 |- badlocation.php
 |- AbstractFactory
 | |- test.php
 | |- other.php
 | \- Invalid.csv
 \- AnEmptyFolder
Arrays will become directories with their key as directory name, and strings becomes files with their key as file name and their value as file content. If no baseDir is given it will try to add the structure to the existing root directory without replacing existing childs except those with equal names.
См. также: https://github.com/mikey179/vfsStream/issues/14
См. также: https://github.com/mikey179/vfsStream/issues/20
С версии: 0.10.0
public static create ( array $structure, vfsStreamDirectory $baseDir = null ) : vfsStreamDirectory
$structure array directory structure to add under root directory
$baseDir vfsStreamDirectory base directory to add structure to
Результат vfsStreamDirectory

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

disable dotfiles in directory listings
С версии: 1.3.0
public static disableDotfiles ( )

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

enable dotfiles in directory listings
С версии: 1.3.0
public static enableDotfiles ( )

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

If the system does not support posix_getgid() the current group will be root (0).
public static getCurrentGroup ( ) : integer
Результат integer

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

If the system does not support posix_getuid() the current user will be root (0).
public static getCurrentUser ( ) : integer
Результат integer

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

If the given content is null it will fall back to use the current root directory of the stream wrapper. Returns given visitor for method chaining comfort.
См. также: https://github.com/mikey179/vfsStream/issues/10
С версии: 0.10.0
public static inspect ( org\bovigo\vfs\visitor\vfsStreamVisitor $visitor, org\bovigo\vfs\vfsStreamContent $content = null ) : org\bovigo\vfs\visitor\vfsStreamVisitor
$visitor org\bovigo\vfs\visitor\vfsStreamVisitor the visitor who inspects
$content org\bovigo\vfs\vfsStreamContent directory structure to inspect
Результат org\bovigo\vfs\visitor\vfsStreamVisitor

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

returns a new block with the given name
public static newBlock ( string $name, integer $permissions = null ) : org\bovigo\vfs\vfsStreamBlock
$name string name of the block device
$permissions integer permissions of block to create
Результат org\bovigo\vfs\vfsStreamBlock

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

If the name contains slashes, a new directory structure will be created. The returned directory will always be the parent directory of this directory structure.
public static newDirectory ( string $name, integer $permissions = null ) : vfsStreamDirectory
$name string name of directory to create
$permissions integer permissions of directory to create
Результат vfsStreamDirectory

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

returns a new file with given name
public static newFile ( string $name, integer $permissions = null ) : org\bovigo\vfs\vfsStreamFile
$name string name of file to create
$permissions integer permissions of file to create
Результат org\bovigo\vfs\vfsStreamFile

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

restores the path from the url
public static path ( string $url ) : string
$url string vfsStream url to translate into path
Результат string

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

sets quota to given amount of bytes
С версии: 1.1.0
public static setQuota ( integer $bytes )
$bytes integer

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

Instead of vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(vfsStream::newDirectory('root')); you can simply do vfsStream::setup() which yields the same result. Additionally, the method returns the freshly created root directory which you can use to make further adjustments to it. Assumed $structure contains an array like this: array('Core' = array('AbstractFactory' => array('test.php' => 'some text content', 'other.php' => 'Some more text content', 'Invalid.csv' => 'Something else', ), 'AnEmptyFolder' => array(), 'badlocation.php' => 'some bad content', ) ) the resulting directory tree will look like this:
root
\- Core
 |- badlocation.php
 |- AbstractFactory
 | |- test.php
 | |- other.php
 | \- Invalid.csv
 \- AnEmptyFolder
Arrays will become directories with their key as directory name, and strings becomes files with their key as file name and their value as file content.
См. также: https://github.com/mikey179/vfsStream/issues/14
См. также: https://github.com/mikey179/vfsStream/issues/20
С версии: 0.7.0
public static setup ( string $rootDirName = 'root', integer $permissions = null, array $structure = [] ) : vfsStreamDirectory
$rootDirName string name of root directory
$permissions integer file permissions of root directory
$structure array directory structure to add under root directory
Результат vfsStreamDirectory

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

If no value is given only the current umask setting is returned.
С версии: 0.8.0
public static umask ( integer $umask = null ) : integer
$umask integer new umask setting
Результат integer

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

prepends the scheme to the given URL
public static url ( string $path ) : string
$path string path to translate to vfsStream url
Результат string

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

checks if vfsStream lists dotfiles in directory listings
С версии: 1.3.0
public static useDotfiles ( ) : boolean
Результат boolean

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

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

initial umask setting
protected static $umask