@@ -34,6 +34,9 @@ discard block |
||
| 34 | 34 | $this->setExcludeExpression($exclude); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param boolean $enabled |
|
| 39 | + */ |
|
| 37 | 40 | public function setEnabled($enabled) |
| 38 | 41 | { |
| 39 | 42 | $this->enabled = (boolean) $enabled; |
@@ -44,6 +47,9 @@ discard block |
||
| 44 | 47 | return $enabled; |
| 45 | 48 | } |
| 46 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string|null $regex |
|
| 52 | + */ |
|
| 47 | 53 | public function setIncludeExpression($regex) |
| 48 | 54 | { |
| 49 | 55 | $this->include = (string) $regex; |
@@ -57,6 +63,9 @@ discard block |
||
| 57 | 63 | return $this->include; |
| 58 | 64 | } |
| 59 | 65 | |
| 66 | + /** |
|
| 67 | + * @param string|null $regex |
|
| 68 | + */ |
|
| 60 | 69 | public function setExcludeExpression($regex) |
| 61 | 70 | { |
| 62 | 71 | $this->exclude = (string) $regex; |
@@ -4,89 +4,89 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Filter |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Whether or not this filter is enabled |
|
| 9 | - * @var boolean |
|
| 10 | - */ |
|
| 11 | - protected $enabled = false; |
|
| 7 | + /** |
|
| 8 | + * Whether or not this filter is enabled |
|
| 9 | + * @var boolean |
|
| 10 | + */ |
|
| 11 | + protected $enabled = false; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Regex to include (applied first) |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $include; |
|
| 13 | + /** |
|
| 14 | + * Regex to include (applied first) |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $include; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Regex to exclude (applied second) |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - protected $exclude; |
|
| 19 | + /** |
|
| 20 | + * Regex to exclude (applied second) |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + protected $exclude; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @param boolean $enabled |
|
| 27 | - * @param string|null $include |
|
| 28 | - * @param string|null $exclude |
|
| 29 | - */ |
|
| 30 | - public function __construct($enabled, $include, $exclude) |
|
| 31 | - { |
|
| 32 | - $this->setEnabled($enabled); |
|
| 33 | - $this->setIncludeExpression($include); |
|
| 34 | - $this->setExcludeExpression($exclude); |
|
| 35 | - } |
|
| 25 | + /** |
|
| 26 | + * @param boolean $enabled |
|
| 27 | + * @param string|null $include |
|
| 28 | + * @param string|null $exclude |
|
| 29 | + */ |
|
| 30 | + public function __construct($enabled, $include, $exclude) |
|
| 31 | + { |
|
| 32 | + $this->setEnabled($enabled); |
|
| 33 | + $this->setIncludeExpression($include); |
|
| 34 | + $this->setExcludeExpression($exclude); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function setEnabled($enabled) |
|
| 38 | - { |
|
| 39 | - $this->enabled = (boolean) $enabled; |
|
| 40 | - } |
|
| 37 | + public function setEnabled($enabled) |
|
| 38 | + { |
|
| 39 | + $this->enabled = (boolean) $enabled; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function isEnabled() |
|
| 43 | - { |
|
| 44 | - return $enabled; |
|
| 45 | - } |
|
| 42 | + public function isEnabled() |
|
| 43 | + { |
|
| 44 | + return $enabled; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function setIncludeExpression($regex) |
|
| 48 | - { |
|
| 49 | - $this->include = (string) $regex; |
|
| 50 | - } |
|
| 47 | + public function setIncludeExpression($regex) |
|
| 48 | + { |
|
| 49 | + $this->include = (string) $regex; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function getIncludeExpression() |
|
| 53 | - { |
|
| 54 | - if (empty($this->include)) { |
|
| 55 | - return false; |
|
| 56 | - } |
|
| 57 | - return $this->include; |
|
| 58 | - } |
|
| 52 | + public function getIncludeExpression() |
|
| 53 | + { |
|
| 54 | + if (empty($this->include)) { |
|
| 55 | + return false; |
|
| 56 | + } |
|
| 57 | + return $this->include; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - public function setExcludeExpression($regex) |
|
| 61 | - { |
|
| 62 | - $this->exclude = (string) $regex; |
|
| 63 | - } |
|
| 60 | + public function setExcludeExpression($regex) |
|
| 61 | + { |
|
| 62 | + $this->exclude = (string) $regex; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function getExcludeExpression() |
|
| 66 | - { |
|
| 67 | - if (empty($this->exclude)) { |
|
| 68 | - return false; |
|
| 69 | - } |
|
| 70 | - return $this->exclude; |
|
| 71 | - } |
|
| 65 | + public function getExcludeExpression() |
|
| 66 | + { |
|
| 67 | + if (empty($this->exclude)) { |
|
| 68 | + return false; |
|
| 69 | + } |
|
| 70 | + return $this->exclude; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - public function filter(Event $event) |
|
| 74 | - { |
|
| 75 | - return ( |
|
| 76 | - // include this event if filtering is off... |
|
| 77 | - $this->isEnabled() == false || |
|
| 78 | - ( |
|
| 79 | - ( |
|
| 80 | - ( // if filtering is on, and there's an include pattern test that pattern... |
|
| 81 | - $this->getIncludeExpression() && |
|
| 82 | - preg_match('%' . $this->getIncludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 83 | - ) |
|
| 84 | - ) && |
|
| 85 | - !( // if there is an exclude pattern, make sure that this event is NOT excluded |
|
| 86 | - $this->getExcludeExpression() && |
|
| 87 | - preg_match('%' . $this->getExcludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 88 | - ) |
|
| 89 | - ) |
|
| 90 | - ); |
|
| 91 | - } |
|
| 73 | + public function filter(Event $event) |
|
| 74 | + { |
|
| 75 | + return ( |
|
| 76 | + // include this event if filtering is off... |
|
| 77 | + $this->isEnabled() == false || |
|
| 78 | + ( |
|
| 79 | + ( |
|
| 80 | + ( // if filtering is on, and there's an include pattern test that pattern... |
|
| 81 | + $this->getIncludeExpression() && |
|
| 82 | + preg_match('%' . $this->getIncludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 83 | + ) |
|
| 84 | + ) && |
|
| 85 | + !( // if there is an exclude pattern, make sure that this event is NOT excluded |
|
| 86 | + $this->getExcludeExpression() && |
|
| 87 | + preg_match('%' . $this->getExcludeExpression() . '%', $event->getProperty('SUMMARY')) |
|
| 88 | + ) |
|
| 89 | + ) |
|
| 90 | + ); |
|
| 91 | + } |
|
| 92 | 92 | } |