本文整理汇总了PHP中stream_wrapper_unregister函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_wrapper_unregister函数的具体用法?PHP stream_wrapper_unregister怎么用?PHP stream_wrapper_unregister使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_wrapper_unregister函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Register the GridFS stream wrapper.
*/
public static function register()
{
if (in_array('gridfs', stream_get_wrappers())) {
stream_wrapper_unregister('gridfs');
}
stream_wrapper_register('gridfs', get_called_class(), \STREAM_IS_URL);
}
示例2: testEvent
public function testEvent()
{
$provider = $this->getProvider();
$provider->addFormat('big', array('width' => 200, 'height' => null, 'constraint' => true));
$media = new Media();
$media->setBinaryContent('x9wjql');
$media->setId(1023456);
stream_wrapper_unregister('http');
stream_wrapper_register('http', 'Sonata\\MediaBundle\\Tests\\Provider\\FakeHttpWrapper');
// pre persist the media
$provider->prePersist($media);
$this->assertEquals('Thomas Rabaix - les tests fonctionnels - Symfony Live 2009', $media->getName(), '::getName() return the file name');
$this->assertEquals('x9wjql', $media->getProviderReference(), '::getProviderReference() is set');
// post persit the media
$provider->postPersist($media);
$provider->postRemove($media);
$media->setProviderStatus('fake');
$provider->preUpdate($media);
$this->assertEquals(MediaInterface::STATUS_OK, $media->getProviderStatus());
$provider->postUpdate($media);
$media->setProviderStatus('fake');
$media->setBinaryContent(null);
$provider->prePersist($media);
$this->assertEquals('fake', $media->getProviderStatus());
$provider->preUpdate($media);
$this->assertEquals('fake', $media->getProviderStatus());
$provider->postPersist($media);
$this->assertEquals('fake', $media->getProviderStatus());
$provider->preRemove($media);
stream_wrapper_restore('http');
}
示例3: register
public static function register()
{
if (in_array('phpspec', stream_get_wrappers())) {
stream_wrapper_unregister('phpspec');
}
stream_wrapper_register('phpspec', 'PhpSpec\\Loader\\StreamWrapper');
}
示例4: set_up
public function set_up()
{
stream_wrapper_unregister('https');
stream_wrapper_register('https', 'MockHttpStreamWrapper', STREAM_IS_URL);
MockHttpStreamWrapper::clear();
parent::set_up();
}
示例5: init
protected function init(Container $container, ResourceLocator $locator)
{
$schemes = $container['config']->get('streams.schemes');
if (!$schemes) {
return;
}
// Set locator to both streams.
Stream::setLocator($locator);
ReadOnlyStream::setLocator($locator);
$registered = stream_get_wrappers();
foreach ($schemes as $scheme => $config) {
if (isset($config['paths'])) {
$locator->addPath($scheme, '', $config['paths']);
}
if (isset($config['prefixes'])) {
foreach ($config['prefixes'] as $prefix => $paths) {
$locator->addPath($scheme, $prefix, $paths);
}
}
if (in_array($scheme, $registered)) {
stream_wrapper_unregister($scheme);
}
$type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
if ($type[0] != '\\') {
$type = '\\Grav\\Component\\Filesystem\\StreamWrapper\\' . $type;
}
if (!stream_wrapper_register($scheme, $type)) {
throw new \InvalidArgumentException("Stream '{$type}' could not be initialized.");
}
}
}
示例6: intercept
/**
* Registers current class as the PHP file stream wrapper.
*
* @return void
*/
public function intercept()
{
if (!$this->isIntercepting) {
stream_wrapper_unregister(self::PROTOCOL);
$this->isIntercepting = stream_wrapper_register(self::PROTOCOL, __CLASS__);
}
}
示例7: unregister
/**
* unregisters vfsStreamWrapper
*/
public static function unregister()
{
if (in_array(vfsStream::SCHEME, stream_get_wrappers()) === true) {
stream_wrapper_unregister(vfsStream::SCHEME);
}
self::$registered = false;
}
示例8: setUp
protected function setUp()
{
if (in_array('sfImageSource', stream_get_wrappers())) {
stream_wrapper_unregister('sfImageSource');
}
stream_wrapper_register('sfImageSource', 'sfImageSourceMock') or die('Failed to register protocol..');
}
示例9: activateHook
public static function activateHook()
{
foreach (static::$protocols as $protocol) {
stream_wrapper_unregister($protocol);
stream_wrapper_register($protocol, static::class);
}
}
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// Set up an intercepting proxy for getimagesize() calls
stream_wrapper_unregister('http');
stream_wrapper_register('http', __CLASS__ . '_proxy');
}
示例11: setUp
public function setUp()
{
parent::setUp();
if (in_array($this->protocol, stream_get_wrappers())) {
stream_wrapper_unregister($this->protocol);
}
}
示例12: testRegisterWithArgument
public function testRegisterWithArgument()
{
$protocol = 'sftptest';
$this->assertTrue(Stream::register($protocol));
$this->assertContains($protocol, stream_get_wrappers());
$this->assertTrue(stream_wrapper_unregister($protocol));
}
示例13: unregisterWrapper
public static function unregisterWrapper()
{
$existed = in_array('stack', stream_get_wrappers());
if ($existed) {
stream_wrapper_unregister('stack');
}
}
示例14: wrap
public static function wrap()
{
foreach (static::$protocols as $protocol) {
stream_wrapper_unregister($protocol);
stream_wrapper_register($protocol, get_called_class());
}
}
示例15: registerStreamWrapper
/**
* Register a stream wrapper according to its scheme and class.
* Must called prior the opening of first stream under this scheme
*/
public static function registerStreamWrapper()
{
if (in_array(static::SCHEME, stream_get_wrappers())) {
stream_wrapper_unregister(static::SCHEME);
}
stream_register_wrapper(static::SCHEME, get_called_class());
}