Implements function as defined in PHPs \streamWrapper.
@param string $path As defined in PHPs \streamWrapper.
@param integer $options As defined in PHPs \streamWrapper.
@hidden
338806
public function dir_opendir($path, $options) {
		$parts = explode('://', $path, 2);

		$this->scheme	= $parts[0];
		$this->dir		= rtrim($parts[1], '/') . '/';
		$this->db		= self::$config[$this->scheme]['db'];
		$this->table	= self::$config[$this->scheme]['table'];

		if ($this->dir === '/') $this->dir = '';

		// handle the different modes
		$sql = $this->db->result("
			SELECT
				id,
				type,
				data,
				UNIX_TIMESTAMP(ctime) AS ctime,
				UNIX_TIMESTAMP(mtime) AS mtime
			FROM ". $this->table ."
			WHERE id RLIKE ?
		", $this->dir . '[^/]+$');
		
		$this->entries = $sql['RESULT'];
		return true;
	}
233245
function _mkdir($path, $mode, $options)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE);
    }
1187238
public function post(
        string $endpoint,
        array $options
    )
    {
        $this->streamBody = $this->client
            ->post($endpoint, $options)
            ->getBody();
    }
247194
public function writes( $path, $stream )
	{
		if( ( $content = @fread( $stream, 0x7ffffffd ) ) === false ) {
			$error = error_get_last();
			throw new Exception( $error['message'] );
		}

		try {
			$this->fs->put( $path, $content );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
605392
private function addTwigPath($path, array $options = [])
    {
        if ($path === 'templates' && $this->pathAdded) {
            return;
        }

        $app = $this->getContainer();

        $position = isset($options['position']) ? $options['position'] : 'append';
        $namespace = isset($options['namespace']) ? $options['namespace'] : FilesystemLoader::MAIN_NAMESPACE;

        $dir = $this->getBaseDirectory()->getDir($path);
        if (!$dir->exists()) {
            return;
        }
        try {
            if ($position === 'prepend') {
                $app['twig.loader.bolt_filesystem']->prependDir($dir, $namespace);
            } else {
                $app['twig.loader.bolt_filesystem']->addDir($dir, $namespace);
            }
        } catch (LoaderError $e) {
            $app['logger.system']->critical(sprintf('%s was unable to add the Twig path %s. %s', $this->getName(), $path, $e->getMessage()), ['event' => 'exception', 'exception' => $e]);
        }
    }
87014
public function stream_open($url, $mode, $options = STREAM_REPORT_ERRORS, &$opened_path = null){
    	$u = parse_url($url);
	    $c = explode('.',$u['host']);
		$c = array_reverse($c);
		
		$this->Controller = null;
		$cN = (isset(self::God()->wrappers[$u['scheme']]['tld'][$c[0]]))
		          ?self::God()->wrappers[$u['scheme']]['tld'][$c[0]]
				  :false;
		
		if(false!==$cN){
			try{
			  $this->Controller = new $cN;
			}catch(Exception $e){
				trigger_error($e->getMessage(), E_USER_NOTICE);
				return false;
			}
		}else{
				trigger_error('Stream handler for '.$url.' not found.', E_USER_NOTICE);
				return false;	
		}
				
    	return  call_user_func(array($this->Controller, __FUNCTION__),$url, $mode, $options );
    }
158619
public function stream_open($path, $mode, $options, &$opened_path)
    {
        if ($this->fileHandle !== null) {
            return false;
        }
        self::restore();
        $path = self::overlayPath($path);
        $this->fileHandle = fopen($path, $mode, (bool)($options & STREAM_USE_PATH));
        self::register();
        return $this->fileHandle !== false;
    }
1182070
public function stream_open($path, $mode, $options, &$opened_path)
	{
		$this->currentString = &StringController::getRef(str_replace('string://', '', $path));

		if ($this->currentString)
		{
			$this->len = strlen($this->currentString);
			$this->pos = 0;
			$this->stat = $this->url_stat($path, 0);

			return true;
		}
		else
		{
			return false;
		}
	}
1002241
public function createUrl($path = '', $options = array())
    {

        $builtUrl = '';
        $hasHttp = stristr($path, 'http://') || stristr($path, 'https://');

        if (!empty($options['addServer']) && !$hasHttp) {
            $builtUrl .= $this->_server;
        }

        if (!stristr($path, self::URL_PREFIX) && !$hasHttp) {
            $builtUrl .= self::URL_PREFIX . '/' . self::API_VERSION;
        }

        $builtUrl .= $path;

        if (!empty($options['addMethod']) || !empty($options['addToken'])) {
            $builtUrl .= (stristr($path, '?') ? '&' : '?');
        }

        if (!empty($options['addMethod'])) {
            $builtUrl .= '_method=' . $options['addMethod'];
        }
        if (!empty($options['addToken'])) {
            $builtUrl .= ($options['addMethod'] ? '&' : '') . 'access_token=' . $this->_auth->accessToken();
        }

        return $builtUrl;

    }
701131
public static function createRouteBuilder($path, array $options = [])
    {
        $defaults = [
            'routeClass' => static::defaultRouteClass(),
            'extensions' => static::$_defaultExtensions,
        ];
        $options += $defaults;

        return new RouteBuilder(static::$_collection, $path, [], [
            'routeClass' => $options['routeClass'],
            'extensions' => $options['extensions'],
        ]);
    }
721816
public function stream_open($aPath, $aMode, $aOptions, &$aOpenedPath)
    {
        $this->path = substr($aPath, 9);
        if (!isset(self::$string[$this->path])) {
            self::$string[$this->path] = '';
        }
        $this->options = $aOptions;
        $aOpenedPath = $this->path;
        $lenght = strlen(self::$string[$this->path]);
        $flags = [
            'r' => [true, false, 0],
            'rb' => [true, false, 0],
            'r+' => [true, true, 0],
            'c+' => [true, true, 0],
            'w' => [false, true, 0],
            'wb' => [false, true, 0],
            'w+' => [true, true, 0],
            'a' => [false, true, $lenght],
            'a+' => [true, true, $lenght],
            'c' => [false, true, 0]
        ];

        if (isset($flags[$aMode])) {
            $flag = $flags[$aMode];
            $this->setFlags($flag[0], $flag[1], $flag[2]);
        } else {
            throw new exceptions\StringStreamException("Unknown stream mode '{$aMode}'");
        }

        if ($aMode === 'w+') {
            $this->stream_truncate(0);
        }

        return true;
    }
703368
public function handles(string $path, array $options = []): string
    {
        return $this->resolver->to($path, $options);
    }
20369
public function save($path='',array $options=array()){
		if(!$path){
			if(!$this->path){
				throw new Exception("Wrong path specified");
			}
			$path=$this->path;
		}
		else if(substr($path,-1)=='/'){
			if(!$this->path){
				throw new Exception("Wrong path specified");
			}
			$path.=pathinfo($this->path,PATHINFO_BASENAME);
		}
		if(!file_put_contents($path,$this->adapter->getContents($options))){
			throw new Exception("Error encountered while saving '$path'");
		}
		$this->path=$path;
		return $path;
	}
146160
public function FileToPDF($path, GrabzItPDFOptions $options = null)
	{
		if (!file_exists($path))
		{
			throw new GrabzItException("File: " . $path . " does not exist", GrabzItException::FILE_NON_EXISTANT_PATH);
		}
		
		$this->HTMLToPDF(file_get_contents($path), $options);
	}
845293
public function script($path, $options = array()) {
		$options = array_merge(array('block' => 'script'), $options);
		$this->_append('js', $path, $options);
	}
146691
protected function writeFile($path)
    {
        $handle = fopen($path, Stream::MODE_READ_WRITE_RESET);

        if ($handle === false) {
            throw new \RuntimeException('Unable to write to path: ' . $path);
        }

        $this->stream->rewind();

        while (!$this->stream->eof()) {
            fwrite($handle, $this->stream->read(4096));
        }

        fclose($handle);
    }
585930
function stream( $options = '' )
    {
        // setting the options allows the adjustment of the headers
        // values at the moment are:
        // 'Content-Disposition'=>'filename'  - sets the filename, though not too sure how well this will
        //        work as in my trial the browser seems to use the filename of the php file with .pdf on the end
        // 'Accept-Ranges'=>1 or 0 - if this is not set to 1, then this header is not included, off by default
        //    this header seems to have caused some problems despite tha fact that it is supposed to solve
        //    them, so I am leaving it off by default.
        // 'compress'=> 1 or 0 - apply content stream compression, this is on (1) by default
        if ( !is_array( $options ) )
        {
            $options = array();
        }
        if ( isset( $options['compress'] ) && $options['compress'] == 0 )
        {
            $tmp = $this->output( 1 );
        }
        else
        {
            $tmp = $this->output();
        }
        $tmp = ltrim( $tmp );

        ob_clean();

        header( 'Pragma: ' );
        header( 'Cache-Control: ' );
        /* Set cache time out to 10 seconds, this should be good enough to work around an IE bug */
        header( "Expires: ". gmdate( 'D, d M Y H:i:s', time() + 10 ) . ' GMT' );
        header( 'X-Powered-By: eZ Publish' );

        header( 'Content-Length: '.strlen( $tmp ) );
        header( 'Content-Type: application/pdf' );
        header( 'Content-Transfer-Encoding: binary' );
        header( 'Accept-Ranges: bytes' );

        ob_end_clean();

        echo $tmp;

        eZExecution::cleanExit();
    }