You are here

public static function vfsStreamWrapperRecordingProxy::setup in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/proxy/vfsStreamWrapperRecordingProxy.php \org\bovigo\vfs\vfsStreamWrapperRecordingProxy::setup()

helper method for setting up vfsStream with the proxy

Parameters

string $rootDirName optional name of root directory:

int $permissions optional file permissions of root directory:

Return value

vfsStreamDirectory

Throws

vfsStreamException

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/proxy/vfsStreamWrapperRecordingProxy.php, line 69

Class

vfsStreamWrapperRecordingProxy
Stream wrapper to mock file system requests.

Namespace

org\bovigo\vfs

Code

public static function setup($rootDirName = 'root', $permissions = null) {
  self::$root = vfsStream::newDirectory($rootDirName, $permissions);
  if (true === self::$registered) {
    return self::$root;
  }
  if (@stream_wrapper_register(vfsStream::SCHEME, __CLASS__) === false) {
    throw new vfsStreamException('A handler has already been registered for the ' . vfsStream::SCHEME . ' protocol.');
  }
  self::$registered = true;
  return self::$root;
}