Tale\Jade\Renderer\Adapter\Stream\Wrapper::stream_open PHP Method

stream_open() public method

(e.g. fopen('tale-jade://data;...'), INCLUDE('tale-jade://data;...')
public stream_open ( string $uri, string $mode, integer $options, &$opened_path ) : boolean
$uri string the Data-URI this stream was opened with
$mode string the stream read/write-mode (useless here)
$options integer the flags for this stream instance (useless here)
return boolean
    public function stream_open($uri, $mode, $options, &$opened_path)
    {
        //Abstract mb_* functions to get UTF-8 working correctly in this bitch
        $substr = function_exists('mb_substr') ? 'mb_substr' : 'substr';
        $strlen = function_exists('mb_strlen') ? 'mb_strlen' : 'strlen';
        $strpos = function_exists('mb_strpos') ? 'mb_strpos' : 'strpos';
        //Our data URI could look like this:
        // tale-jade://data;<base64-encoded-phtml>
        //We strip everything behind th first ;, the result would be only
        // <base64-encoded-phtml>
        //We decode that and $_data will contain only the pure, compiled PHTML
        //ready for inclusion
        $this->data = base64_decode($substr($uri, $strpos($uri, ';') + 1));
        $this->position = 0;
        $this->length = $strlen($this->data);
        return true;
    }