Gc\View\Stream::register PHP Method

register() public static method

Register stream wrapper
public static register ( string $name = 'zend.view', boolean $overwrite = true ) : void
$name string Name
$overwrite boolean Overwrite wrapper
return void
    public static function register($name = 'zend.view', $overwrite = true)
    {
        if (in_array($name, stream_get_wrappers())) {
            if (!$overwrite) {
                return;
            }
            stream_wrapper_unregister($name);
        }
        stream_wrapper_register($name, 'Gc\\View\\Stream');
    }

Usage Example

Example #1
0
function glob($pattern, $flags = 0)
{
    Stream::register();
    if (preg_match('~\\.sql$~', $pattern)) {
        $content = trim(file_get_contents('zend.view://test-updater'));
        if (empty($content)) {
            return false;
        }
        return array('zend.view://test-updater');
    }
    $scriptPath = GC_APPLICATION_PATH . '/tests/library/Gc/Core/_files/test.php';
    if (file_exists($scriptPath) and in_array($pattern, array(GC_APPLICATION_PATH . '/data/update/*', '999/*.php'))) {
        $content = file_get_contents($scriptPath);
        if ($pattern == GC_APPLICATION_PATH . '/data/update/*') {
            if (empty($content)) {
                return array('0');
            }
            return array(999);
        } else {
            if (empty($content)) {
                return array();
            }
            return array($scriptPath);
        }
    }
    return array('9999.999.999');
}
All Usage Examples Of Gc\View\Stream::register