Zend Framework  3.0
Public Member Functions | Protected Attributes | List of all members
Stream Class Reference

Stream wrapper to convert markup of mostly-PHP templates into PHP prior to include(). More...

Public Member Functions

 stream_open ($path, $mode, $options, &$opened_path)
 Opens the script file and converts markup.
 
 url_stat ()
 Included so that __FILE__ returns the appropriate info.
 
 stream_read ($count)
 Reads from the stream.
 
 stream_tell ()
 Tells the current position in the stream.
 
 stream_eof ()
 Tells if we are at the end of the stream.
 
 stream_stat ()
 Stream statistics.
 
 stream_seek ($offset, $whence)
 Seek to a specific point in the stream.
 

Protected Attributes

 $pos = 0
 
 $data
 
 $stat
 

Detailed Description

Stream wrapper to convert markup of mostly-PHP templates into PHP prior to include().

Based in large part on the example at http://www.php.net/manual/en/function.stream-wrapper-register.php

As well as the example provided at: http://mikenaberezny.com/2006/02/19/symphony-templates-ruby-erb/ written by Mike Naberezny (Paul M. Jones ( http://paul-m-jones.com)

Member Function Documentation

stream_eof ( )

Tells if we are at the end of the stream.

Returns
bool
stream_open (   $path,
  $mode,
  $options,
$opened_path 
)

Opens the script file and converts markup.

Parameters
string$path
$mode
$options
$opened_path
Returns
bool

If reading the file failed, update our local stat store to reflect the real stat of the file, then return on failure

Convert <?= ?> to long-form <?php echo ?> and <?php ?> to <?php ?>

file_get_contents() won't update PHP's stat cache, so we grab a stat of the file to prevent additional reads should the script be requested again, which will make include() happy.

stream_read (   $count)

Reads from the stream.

Parameters
int$count
Returns
string
stream_seek (   $offset,
  $whence 
)

Seek to a specific point in the stream.

Parameters
$offset
$whence
Returns
bool
stream_stat ( )

Stream statistics.

Returns
array
stream_tell ( )

Tells the current position in the stream.

Returns
int
url_stat ( )

Included so that __FILE__ returns the appropriate info.

Returns
array

Member Data Documentation

$data
protected
$pos = 0
protected
$stat
protected