public static function get($name = null)
{
$name = static::setDirectorySeparator($name ?: uniqid());
$adapter = static::getAdapter();
if (($protocol = static::getProtocol($name)) === null) {
$protocol = static::defaultProtocol;
$name = $protocol . static::protocolSeparator . $name;
}
if (in_array($protocol, $adapter->stream_get_wrappers()) === false && $adapter->stream_wrapper_register($protocol, get_called_class(), 0) === false) {
throw new exceptions\runtime('Unable to register ' . $protocol . ' stream');
}
$stream = static::findControllerForStream($name);
if ($stream === null) {
static::$streams[] = $stream = static::getController($name);
}
return $stream;
}
public function testGetFirstError() { $this->if($includer = new testedClass($adapter = new atoum\test\adapter()))->then->variable($includer->getFirstError())->isNull()->if($adapter->set_error_handler = function ($errorHandler) { set_error_handler($errorHandler); return null; })->and($fileWithError = stream::get())->and($fileWithError->file_get_contents = '<?php trigger_error(\'' . ($message = uniqid()) . '\', E_USER_WARNING); ?>')->and($includer->includePath($fileWithError))->then->array($error = $includer->getFirstError())->isNotEmpty()->integer($error[0])->isEqualTo(E_USER_WARNING)->string($error[1])->isEqualTo($message); }