Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Stream\Filter\LateComputed Class Reference
Inheritance diagram for Hoa\Stream\Filter\LateComputed:

Public Member Functions

 filter ($in, $out, &$consumed, $closing)
 
- Public Member Functions inherited from Hoa\Stream\Filter\Basic
 filter ($in, $out, &$consumed, $closing)
 
 onCreate ()
 
 onClose ()
 
 setName ($name)
 
 setParameters ($parameters)
 
 getName ()
 
 getParameters ()
 
 getStream ()
 

Protected Member Functions

 compute ()
 

Protected Attributes

 $_buffer = null
 

Additional Inherited Members

- Public Attributes inherited from Hoa\Stream\Filter\Basic
const PASS_ON = PSFS_PASS_ON
 
const FEED_ME = PSFS_FEED_ME
 
const FATAL_ERROR = PSFS_ERR_FATAL
 
const FLAG_NORMAL = PSFS_FLAG_NORMAL
 
const FLAG_FLUSH_INC = PSFS_FLAG_FLUSH_INC
 
const FLAG_FLUSH_CLOSE = PSFS_FLAG_FLUSH_CLOSE
 

Detailed Description

Class .

A late computed filter computes the data when closing the filtering.

Definition at line 49 of file LateComputed.php.

Member Function Documentation

Hoa\Stream\Filter\LateComputed::compute ( )
abstractprotected

Compute the whole data (stored in $this->_buffer).

Returns
string

Here is the caller graph for this function:

Hoa\Stream\Filter\LateComputed::filter (   $in,
  $out,
$consumed,
  $closing 
)

Filter data. This method is called whenever data is read from or written to the attach stream.

Parameters
resource$inA resource pointing to a bucket brigade which contains one or more bucket objects containing data to be filtered.
resource$outA resource pointing to a second bucket brigade into which your modified buckets should be replaced.
int&$consumedWhich must always be declared by reference, should be incremented by the length of the data which your filter reads in and alters.
bool$closingIf the stream is in the process of closing (and therefore this is the last pass through the filterchain), the closing parameter will be set to true.
Returns
int

Definition at line 81 of file LateComputed.php.

82  {
83  $return = self::FEED_ME;
84  $iBucket = new Stream\Bucket($in);
85 
86  while (false === $iBucket->eob()) {
87  $this->_buffer .= $iBucket->getData();
88  $consumed += $iBucket->getLength();
89  }
90 
91  if (null !== $consumed) {
92  $return = self::PASS_ON;
93  }
94 
95  if (true === $closing) {
96  $stream = $this->getStream();
97  $this->compute();
98  $bucket = new Stream\Bucket(
99  $stream,
100  Stream\Bucket::IS_A_STREAM,
101  $this->_buffer
102  );
103  $oBucket = new Stream\Bucket($out);
104  $oBucket->append($bucket);
105 
106  $return = self::PASS_ON;
107  $this->_buffer = null;
108  }
109 
110  return $return;
111  }
const IS_A_STREAM
Definition: Bucket.php:61

Here is the call graph for this function:

Member Data Documentation

Hoa\Stream\Filter\LateComputed::$_buffer = null
protected

Definition at line 56 of file LateComputed.php.


The documentation for this class was generated from the following file: