| @@ 45-59 (lines=15) @@ | ||
| 42 | * @param bool $closing |
|
| 43 | * @return int |
|
| 44 | */ |
|
| 45 | public function filter($in, $out, &$consumed, $closing) |
|
| 46 | { |
|
| 47 | while ($bucket = stream_bucket_make_writeable($in)) { |
|
| 48 | $converted = $this->converter->convert($bucket->data); |
|
| 49 | $consumed += strlen($bucket->data); |
|
| 50 | ||
| 51 | // $this->stream is undocumented. It was found looking at HHVM's source code |
|
| 52 | // for its convert.iconv.* implementation in ConvertIconFilter and explained |
|
| 53 | // somewhat in this StackOverflow page: http://stackoverflow.com/a/31132646/335059 |
|
| 54 | // declaring a member variable called 'stream' breaks the PHP implementation (5.5.9 |
|
| 55 | // at least). |
|
| 56 | stream_bucket_append($out, stream_bucket_new($this->stream, $converted)); |
|
| 57 | } |
|
| 58 | return PSFS_PASS_ON; |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Overridden to extract the charset from the params array and check if the |
|
| @@ 63-70 (lines=8) @@ | ||
| 60 | * @param bool $closing |
|
| 61 | * @return int |
|
| 62 | */ |
|
| 63 | public function filter($in, $out, &$consumed, $closing) |
|
| 64 | { |
|
| 65 | while ($bucket = stream_bucket_make_writeable($in)) { |
|
| 66 | $data = call_user_func($this->fnFilterName, $bucket->data); |
|
| 67 | stream_bucket_append($out, stream_bucket_new($this->stream, $data)); |
|
| 68 | } |
|
| 69 | return PSFS_PASS_ON; |
|
| 70 | } |
|
| 71 | } |
|