classes/phing/filters/LineContainsRegexp.php
public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->setInitialized(true);
        }

        $buffer = $this->in->read($len);

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

        $lines = explode("\n", $buffer);
        $matched = [];

        $regexpsSize = count($this->_regexps);
        foreach ($lines as $line) {
            for ($i = 0; $i < $regexpsSize; $i++) {
                $regexp = $this->_regexps[$i];
                $re = $regexp->getRegexp($this->getProject());
                $re->setIgnoreCase(!$this->casesensitive);
                $matches = $re->matches($line);
                if (!$matches) {
                    $line = null;
                    break;
                }
            }
            if ($line !== null) {
                $matched[] = $line;
            }
        }
        $filtered_buffer = implode("\n", $matched);

        if ($this->isNegated()) {
            $filtered_buffer = implode("\n", array_diff($lines, $matched));
        }

        return $filtered_buffer;
    }
public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->_initialize();
            $this->setInitialized(true);
        }

        $buffer = $this->in->read($len);

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

        $lines = explode("\n", $buffer);
        $matched = [];

        $regexpsSize = count($this->_regexps);
        foreach ($lines as $line) {
            for ($i = 0; $i < $regexpsSize; $i++) {
                $regexp = $this->_regexps[$i];
                $re = $regexp->getRegexp($this->getProject());
                $re->setIgnoreCase(!$this->casesensitive);
                $matches = $re->matches($line);
                if (!$matches) {
                    $line = null;
                    break;
                }
            }
            if ($line !== null) {
                $matched[] = $line;
            }
        }
        $filtered_buffer = implode("\n", $matched);

        if ($this->isNegated()) {
            $filtered_buffer = implode("\n", array_diff($lines, $matched));
        }

        return $filtered_buffer;
    }
public function read ( $ len = null ) { if ( ! $ this -> getInitialized ( ) ) { $ this -> _initialize ( ) ; $ this -> setInitialized ( true ) ; } $ buffer = $ this -> in -> read ( $ len ) ; if ( $ buffer === - 1 ) { return - 1 ; } $ lines = explode ( "\n" , $ buffer ) ; $ matched = [ ] ; $ regexpsSize = count ( $ this -> _regexps ) ; foreach ( $ lines as $ line ) { for ( $ i = 0 ; $ i < $ regexpsSize ; $ i ++ ) { $ regexp = $ this -> _regexps [ $ i ] ; $ re = $ regexp -> getRegexp ( $ this -> getProject ( ) ) ; $ re -> setIgnoreCase ( ! $ this -> casesensitive ) ; $ matches = $ re -> matches ( $ line ) ; if ( ! $ matches ) { $ line = null ; break ; } } if ( $ line !== null ) { $ matched [ ] = $ line ; } } $ filtered_buffer = implode ( "\n" , $ matched ) ; if ( $ this -> isNegated ( ) ) { $ filtered_buffer = implode ( "\n" , array_diff ( $ lines , $ matched ) ) ; } return $ filtered_buffer ; }
Returns all lines in a buffer that contain specified strings.

@param  null $len
@return mixed buffer, -1 on EOF
Returns all lines in a buffer that contain specified strings .