Back to Stream class

Method appendFilter

public mixed
appendFilter
(mixed $filterName, mixed $readWrite = STREAM_FILTER_READ, mixed $params = array())
Stream filters Append a filter to the chain
Parameters
  • string $filterName The key name of the filter.
  • int $readWrite Optional. Defaults to STREAM_FILTER_READ.
  • array $params An array of params for the stream_filter_append call.
Returns
  • mixed
Since
  • 1.7.0
-
  • https://www.php.net/manual/en/function.stream-filter-append.php
Class: Stream
Project: Joomla

Method appendFilter - Source code

/**
 * Stream filters
 * Append a filter to the chain
 *
 * @param   string   $filterName  The key name of the filter.
 * @param   integer  $readWrite   Optional. Defaults to STREAM_FILTER_READ.
 * @param   array    $params      An array of params for the stream_filter_append call.
 *
 * @return  mixed
 *
 * @link    https://www.php.net/manual/en/function.stream-filter-append.php
 * @since   1.7.0
 */
public function appendFilter($filterName, $readWrite = STREAM_FILTER_READ, $params = array())
{
    $res = false;
    if ($this->fh) {
        // Capture PHP errors
        $php_errormsg = '';
        $track_errors = ini_get('track_errors');
        ini_set('track_errors', true);
        $res = @stream_filter_append($this->fh, $filterName, $readWrite, $params);
        if (!$res && $php_errormsg) {
            $this->setError($php_errormsg);
        } else {
            $this->filters[] =& $res;
        }
        // Restore error tracking to what it was before.
        ini_set('track_errors', $track_errors);
    }
    return $res;
}