classes/phing/filters/ReplaceRegexp.php
public function read($len = null)
    {
        $buffer = $this->in->read($len);

        if ($buffer === -1) {
            return -1;
        }

        // perform regex replace here ...
        foreach ($this->regexps as $exptype) {
            $regexp = $exptype->getRegexp($this->project);
            try {
                $buffer = $regexp->replace($buffer);
                $this->log(
                    "Performing regexp replace: /" . $regexp->getPattern() . "/" . $regexp->getReplace() . "/g" . $regexp->getModifiers(),
                    Project::MSG_VERBOSE
                );
            } catch (Exception $e) {
                // perhaps mismatch in params (e.g. no replace or pattern specified)
                $this->log("Error performing regexp replace: " . $e->getMessage(), Project::MSG_WARN);
            }
        }

        return $buffer;
    }
public function read($len = null)
    {
        $buffer = $this->in->read($len);

        if ($buffer === -1) {
            return -1;
        }

        // perform regex replace here ...
        foreach ($this->regexps as $exptype) {
            $regexp = $exptype->getRegexp($this->project);
            try {
                $buffer = $regexp->replace($buffer);
                $this->log(
                    "Performing regexp replace: /" . $regexp->getPattern() . "/" . $regexp->getReplace() . "/g" . $regexp->getModifiers(),
                    Project::MSG_VERBOSE
                );
            } catch (Exception $e) {
                // perhaps mismatch in params (e.g. no replace or pattern specified)
                $this->log("Error performing regexp replace: " . $e->getMessage(), Project::MSG_WARN);
            }
        }

        return $buffer;
    }
public function read ( $ len = null ) { $ buffer = $ this -> in -> read ( $ len ) ; if ( $ buffer === - 1 ) { return - 1 ; } // perform regex replace here ... foreach ( $ this -> regexps as $ exptype ) { $ regexp = $ exptype -> getRegexp ( $ this -> project ) ; try { $ buffer = $ regexp -> replace ( $ buffer ) ; $ this -> log ( "Performing regexp replace: /" . $ regexp -> getPattern ( ) . "/" . $ regexp -> getReplace ( ) . "/g" . $ regexp -> getModifiers ( ) , Project :: MSG_VERBOSE ) ; } catch ( Exception $ e ) { // perhaps mismatch in params (e.g. no replace or pattern specified) $ this -> log ( "Error performing regexp replace: " . $ e -> getMessage ( ) , Project :: MSG_WARN ) ; } } return $ buffer ; }
Returns the filtered stream.
The original stream is first read in fully, and the regex replace is performed.

@param int $len Required $len for Reader compliance.

@return mixed The filtered stream, or -1 if the end of the resulting stream has been reached.

@exception IOException if the underlying stream throws an IOException
during reading
Returns the filtered stream . The original stream is first read in fully and the regex replace is performed .