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

Public Member Functions

 filter ($in, $out, &$consumed, $closing)
 
 onCreate ()
 
 onClose ()
 
 setName ($name)
 
 setParameters ($parameters)
 
 getName ()
 
 getParameters ()
 
 getStream ()
 

Public Attributes

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 .

Basic filter. Force to implement some methods. Actually, it extends the php_user_filter class.

Definition at line 50 of file Basic.php.

Member Function Documentation

Hoa\Stream\Filter\Basic::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 119 of file Basic.php.

120  {
121  $iBucket = new Stream\Bucket($in);
122  $oBucket = new Stream\Bucket($out);
123 
124  while (false === $iBucket->eob()) {
125  $consumed += $iBucket->getLength();
126  $oBucket->append($iBucket);
127  }
128 
129  unset($iBucket);
130  unset($oBucket);
131 
132  return self::PASS_ON;
133  }
Hoa\Stream\Filter\Basic::getName ( )

Get the filter name.

Returns
string

Definition at line 189 of file Basic.php.

190  {
191  return $this->filtername;
192  }
Hoa\Stream\Filter\Basic::getParameters ( )

Get the filter parameters.

Returns
mixed

Definition at line 199 of file Basic.php.

200  {
201  return $this->params;
202  }
Hoa\Stream\Filter\Basic::getStream ( )

Get the stream resource being filtered. Maybe available only during filter calls when the closing parameter is set to false.

Returns
resource

Definition at line 211 of file Basic.php.

212  {
213  return $this->stream;
214  }

Here is the caller graph for this function:

Hoa\Stream\Filter\Basic::onClose ( )

Called upon filter shutdown (typically, this is also during stream shutdown), and is executed after the flush method is called.

Returns
void

Definition at line 151 of file Basic.php.

152  {
153  return;
154  }
Hoa\Stream\Filter\Basic::onCreate ( )

Called during instanciation of the filter class object.

Returns
bool

Definition at line 140 of file Basic.php.

141  {
142  return true;
143  }
Hoa\Stream\Filter\Basic::setName (   $name)

Set the filter name.

Parameters
string$nameFilter name.
Returns
string

Definition at line 162 of file Basic.php.

163  {
164  $old = $this->filtername;
165  $this->filtername = $name;
166 
167  return $old;
168  }
Hoa\Stream\Filter\Basic::setParameters (   $parameters)

Set the filter parameters.

Parameters
mixed$parametersFilter parameters.
Returns
mixed

Definition at line 176 of file Basic.php.

177  {
178  $old = $this->params;
179  $this->params = $parameters;
180 
181  return $old;
182  }

Member Data Documentation

const Hoa\Stream\Filter\Basic::FATAL_ERROR = PSFS_ERR_FATAL

The filter experienced and unrecoverable error and cannot continue.

int

Definition at line 73 of file Basic.php.

const Hoa\Stream\Filter\Basic::FEED_ME = PSFS_FEED_ME

Filter processed successfully, however no data was available to return. More data is required from the stream or prior filter.

int

Definition at line 66 of file Basic.php.

const Hoa\Stream\Filter\Basic::FLAG_FLUSH_CLOSE = PSFS_FLAG_FLUSH_CLOSE

Final flush prior to closing.

int

Definition at line 94 of file Basic.php.

const Hoa\Stream\Filter\Basic::FLAG_FLUSH_INC = PSFS_FLAG_FLUSH_INC

An incremental flush.

int

Definition at line 87 of file Basic.php.

const Hoa\Stream\Filter\Basic::FLAG_NORMAL = PSFS_FLAG_NORMAL

Regular read/write.

int

Definition at line 80 of file Basic.php.

const Hoa\Stream\Filter\Basic::PASS_ON = PSFS_PASS_ON

Filter processed successfully with data available in the out bucket brigade.

int

Definition at line 58 of file Basic.php.


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