# Class LoggerFilterStringMatch

This is a very simple filter based on string matching.

The filter admits two options `LoggerFilterStringMatch::$stringToMatch` and `LoggerFilterStringMatch::$acceptOnMatch`. If there is a match (using PHP_MANUAL#strpos between the value of the `LoggerFilterStringMatch::$stringToMatch` option and the message of the `LoggerLoggingEvent`, then the `LoggerFilterStringMatch::decide()` method returns `LoggerFilter::ACCEPT` if the AcceptOnMatch option value is true, if it is false then `LoggerFilter::DENY` is returned. If there is no match, `LoggerFilter::NEUTRAL` is returned.

An example for this filter:

{@example ../../examples/php/filter_stringmatch.php 19}

The corresponding XML file:

{@example ../../examples/resources/filter_stringmatch.xml 18}

  LoggerConfigurable
  LoggerFilter
  LoggerFilterStringMatch

Package: log4php\filters
Version: $Revision: 1213283 $
Since: 0.3
Located at filters/LoggerFilterStringMatch.php

Methods summary
`public` | # `setAcceptOnMatch( mixed $acceptOnMatch )`

#### Parameters

$acceptOnMatch
  `mixed`
  $acceptOnMatch a boolean or a string ('true' or 'false')

`public` | # `setStringToMatch( string $string )`

#### Parameters

$string
  `string`
  $s the string to match

`public integer` | # `decide( `LoggerLoggingEvent` $event )`

#### Parameters

$event
  ``LoggerLoggingEvent``
  $event The `LoggerLoggingEvent` to decide upon.

#### Returns

`integer`
a LOGGER_FILTER_NEUTRAL is there is no string match.

#### Overrides

`LoggerFilter::decide()`

Methods inherited from LoggerFilter
`activateOptions(), addNext(), getNext()`

Methods inherited from LoggerConfigurable
`setBoolean(), setFileSize(), setInteger(), setLevel(), setNumeric(), setPositiveInteger(), setString(), warn()`

Constants inherited from LoggerFilter
`ACCEPT, DENY, NEUTRAL`

Properties summary
`protected boolean` | $acceptOnMatch | `true` | #
`protected string` | $stringToMatch | `` | #

Properties inherited from LoggerFilter
`$next`