Hoa central
Basic.php
Go to the documentation of this file.
1 <?php
2 
38 
39 use Hoa\Stream;
40 
50 abstract class Basic extends \php_user_filter
51 {
58  const PASS_ON = PSFS_PASS_ON;
59 
66  const FEED_ME = PSFS_FEED_ME;
67 
73  const FATAL_ERROR = PSFS_ERR_FATAL;
74 
80  const FLAG_NORMAL = PSFS_FLAG_NORMAL;
81 
87  const FLAG_FLUSH_INC = PSFS_FLAG_FLUSH_INC;
88 
94  const FLAG_FLUSH_CLOSE = PSFS_FLAG_FLUSH_CLOSE;
95 
96 
97 
119  public function filter($in, $out, &$consumed, $closing)
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  }
134 
140  public function onCreate()
141  {
142  return true;
143  }
144 
151  public function onClose()
152  {
153  return;
154  }
155 
162  public function setName($name)
163  {
164  $old = $this->filtername;
165  $this->filtername = $name;
166 
167  return $old;
168  }
169 
176  public function setParameters($parameters)
177  {
178  $old = $this->params;
179  $this->params = $parameters;
180 
181  return $old;
182  }
183 
189  public function getName()
190  {
191  return $this->filtername;
192  }
193 
199  public function getParameters()
200  {
201  return $this->params;
202  }
203 
211  public function getStream()
212  {
213  return $this->stream;
214  }
215 }
filter($in, $out, &$consumed, $closing)
Definition: Basic.php:119
setParameters($parameters)
Definition: Basic.php:176