You are here

public static function vfsStreamWrapper::unregister in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php \org\bovigo\vfs\vfsStreamWrapper::unregister()

Unregisters a previously registered URL wrapper for the vfs scheme.

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

Throws

vfsStreamException

4 calls to vfsStreamWrapper::unregister()
vfsStreamWrapperUnregisterTestCase::unregisterRegisteredUrlWrapper in vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
Unregistering a registered URL wrapper.
vfsStreamWrapperUnregisterTestCase::unregisterThirdPartyVfsScheme in vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
Unregistering a third party wrapper for vfs:// fails.
vfsStreamWrapperUnregisterTestCase::unregisterWhenNotInRegisteredState in vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
Unregistering when not in registered state will fail.
vfsStreamWrapperUnregisterTestCase::unregisterWhenNotRegistered in vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperUnregisterTestCase.php
Unregistering while not registers won't fail.
1 method overrides vfsStreamWrapper::unregister()
TestvfsStreamWrapper::unregister in vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperAlreadyRegisteredTestCase.php
unregisters vfsStreamWrapper

File

vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/vfsStreamWrapper.php, line 129

Class

vfsStreamWrapper
Stream wrapper to mock file system requests.

Namespace

org\bovigo\vfs

Code

public static function unregister() {
  if (!self::$registered) {
    if (in_array(vfsStream::SCHEME, stream_get_wrappers())) {
      throw new vfsStreamException('The URL wrapper for the protocol ' . vfsStream::SCHEME . ' was not registered with this version of vfsStream.');
    }
    return;
  }
  if (!@stream_wrapper_unregister(vfsStream::SCHEME)) {
    throw new vfsStreamException('Failed to unregister the URL wrapper for the ' . vfsStream::SCHEME . ' protocol.');
  }
  self::$registered = false;
}