5 class Hexify extends \php_user_filter
9 public function onCreate()
11 $this->uppercase = isset($this->params[
'uppercase']) ? (bool) $this->params[
'uppercase'] :
false;
14 public function filter($in, $out, &$consumed, $closing)
16 while ($bucket = stream_bucket_make_writeable($in)) {
17 $consumed += $bucket->datalen;
18 $output = bin2hex($bucket->data);
20 if ($this->uppercase) {
21 $output = strtoupper($output);
24 $outBucket = stream_bucket_new($this->stream, $output);
25 stream_bucket_append($out, $outBucket);