LineContains

Extends \BaseParamFilterReader Implements \ChainableReader

Filter which includes only those lines that contain all the user-specified strings.

Example:


  
  

Or:


   
   

This will include only those lines that contain foo and bar.

author

Yannick Lecaillez yl@seasonfive.com

author

Hans Lellelid hans@velum.net

version

$Id: eefe1fb232a40f0dba60af78729abac0480d6bcd $

see
package

phing.filters

Methods

__construct

__construct(\Reader $in = null) 
inherited

Arguments

$in

\Reader

Parses the parameters to add user-defined contains strings.

_initialize() 

Creates a new LineContains using the passed in Reader for instantiation.

chain(\Reader $reader) : object

Arguments

$reader

\Reader

Response

object

A new filter based on this configuration, but filtering

    the specified reader

Close stream.

close() 
inherited abstract
throws

if there is an error closing stream

Adds a <code>contains</code> nested element.

createContains() : \Contains

Response

\Contains

The contains element added.

             Must not be <code>null</code>.

Returns whether the end of file has been reached with input stream.

eof() : boolean
inherited

Response

boolean

Returns the vector of words which must be contained within a line read from the original stream in order for it to match this filter.

getContains() : array

Response

array

The array of words which must be contained within a line read

    from the original stream in order for it to match this filter. The
    returned object is "live" - in other words, changes made to the
    returned object are mirrored in the filter.

Returns the initialized status.

getInitialized() : boolean
inherited

Response

boolean

whether or not the filter is initialized

getParameters

getParameters() 
inherited

Returns the project this filter is part of.

getProject() : object
inherited

Response

object

The project this filter is part of

Returns the filename, url, etc. that is being read from.

getResource() : string
inherited abstract

This is critical for, e.g., ExpatParser's ability to know the filename that is throwing an ExpatParserException, etc.

Response

string

Convenience method to support logging in filters.

log(string $msg, integer $level = \Project::MSG_INFO) 
inherited

Arguments

$msg

string

Message to log.

$level

integer

Priority level.

If supported, places a "marker" (like a bookmark) at current stream position.

mark() 
inherited

A subsequent call to reset() will move stream position back to last marker (if supported).

Whether marking is supported.

markSupported() : boolean
inherited

Response

boolean

Read data from source.

read(integer $len = null) 
inherited abstract

If length is specified, then only that number of chars is read, otherwise stream is read until EOF.

Arguments

$len

integer

[Deprecated. For reference only, used to be read() method.] Returns the next character in the filtered stream, only including lines from the original stream which contain all of the specified words.

readChar() : \the
exception

IOException if the underlying stream throws an IOException during reading

Response

\the

next character in the resulting stream, or -1 if the end of the resulting stream has been reached

Reads a line of text ending with '\n' (or until the end of the stream).

readLine() : \the
inherited

The returned String retains the '\n'.

throws

if the underlying reader throws one during

                   reading

Response

\the

line read, or null if the end of the stream has already been reached

Is stream ready for reading.

ready() : boolean
inherited

Response

boolean

Reset the current position in stream to beginning or last mark (if supported).

reset() 
inherited

Sets the array of words which must be contained within a line read from the original stream in order for it to match this filter.

setContains(array $contains) 

Arguments

$contains

array

An array of words which must be contained

            within a line in order for it to match in this filter.
            Must not be <code>null</code>.

Sets the initialized status.

setInitialized(boolean $initialized) 
inherited

Arguments

$initialized

boolean

Whether or not the filter is initialized.

setParameters

setParameters( $parameters) 
inherited

Arguments

$parameters

Sets the project to work with.

setProject(object $project) 
inherited

Arguments

$project

object

The project this filter is part of.

           Should not be <code>null</code>.

setReader

setReader(\Reader $in) 
inherited

Arguments

$in

\Reader

Move stream position relative to current pos.

skip(integer $n) 
inherited

Arguments

$n

integer

Constants

The parameter name for the string to match on.

CONTAINS_KEY
var

Properties

Array of Contains objects.

_contains : array
var

Type(s)

array

[Deprecated]

_line : string
var

Type(s)

string

The passed in parameter array.

_parameters : 
inherited

Type(s)

Have the parameters passed been interpreted?

initialized : 
inherited

Type(s)

The Phing project this filter is part of.

project : 
inherited

Type(s)

in

in : \Reader
inherited
var

Type(s)

\Reader