\Tale\Jade\Renderer\Adapter\StreamWrapper

Provides a Stream Wrapper that reads a special Data-URI.

See the php docs on Stream Wrappers to get to know about this

It allows you to create own URL wrappers and handle them by yourself It works with most of the f*-functions of PHP (fopen, fread, fwrite, INCLUDE(!!!!), etc.)

Summary

Methods
Properties
Constants
stream_open()
stream_read()
stream_tell()
stream_eof()
stream_stat()
isRegistered()
register()
unregister()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$_data
$_position
$_length
N/A

Properties

$_data

$_data : string

The input data (compiled PHTML).

Type

string

$_position

$_position : integer

The current position in our $_data.

Type

integer

$_length

$_length : integer

The length of our $_data.

Type

integer

Methods

stream_open()

stream_open(string  $uri, string  $mode, integer  $options,   $opened_path) : boolean

This gets called when a url-stream is opened with the wrapper-scheme.

(e.g. fopen('tale-jade://data;...'), INCLUDE('tale-jade://data;...')

Parameters

string $uri

the Data-URI this stream was opened with

string $mode

the stream read/write-mode (useless here)

integer $options

the flags for this stream instance (useless here)

$opened_path

Returns

boolean

stream_read()

stream_read(integer  $length) : string

This gets called when anything tries to read from this.

(opened) stream (e.g. fread, fgets, fgetcsv, INCLUDE(!!!) etc.)

We return the fitting chunk of our PHTML and add that length of that to our current position so that the next call will read the next chunk, rinse and repeat

Parameters

integer $length

the length of the chunk to read

Returns

string

stream_tell()

stream_tell() : integer

Gets called when someone calls something like ftell on this stream.

Returns the current position in our stream

Returns

integer

stream_eof()

stream_eof() : boolean

Gets called when someone calls something like feof on this stream.

Returns true, if the stream is at the end of data or false, if there's still PHTML left to read

Returns

boolean

stream_stat()

stream_stat() : array

This gets called when someone calls fstat on this stream.

It's a requirement to define stream_stat() for some functions We just return an empty array

Returns

array

isRegistered()

isRegistered(string  $name) : boolean

Checks if a stream wrapper with the given scheme/name is registered.

Parameters

string $name

The scheme/name of the stream wrapper

Returns

boolean

register()

register(string  $name) 

Registers this class a a stream wrapper with the given scheme/name.

Parameters

string $name

The scheme/name this wrapper should react on

unregister()

unregister(string  $name) 

Unregisters the stream wrapper with the given scheme/name.

Parameters

string $name

The scheme/name of the stream wrapper to be unregistered