51 $args = func_get_args();
52 foreach ($args as $arg) {
53 if (!($arg instanceof \
Erebot\Interfaces\Event\Match)) {
54 throw new \Erebot\InvalidValueException(
'Not a valid matcher');
57 $this->submatchers = $args;
63 return count($this->submatchers);
69 return isset($this->submatchers[$offset]);
75 return $this->submatchers[$offset];
81 if (!($value instanceof \
Erebot\Interfaces\Event\Match)) {
82 throw new \Erebot\InvalidValueException(
'Not a valid matcher');
84 $this->submatchers[$offset] = $value;
90 unset($this->submatchers[$offset]);
105 public function &
add($filter)
107 $filters = func_get_args();
108 foreach ($filters as $filter) {
109 if (!($filter instanceof \
Erebot\Interfaces\Event\Match)) {
110 throw new \Erebot\InvalidValueException(
'Not a valid matcher');
112 if (!in_array($filter, $this->submatchers,
true)) {
113 $this->submatchers[] = $filter;
132 public function &
remove($filter)
134 $filters = func_get_args();
135 foreach ($filters as $filter) {
136 if (!($filter instanceof \
Erebot\Interfaces\Event\Match)) {
137 throw new \Erebot\InvalidValueException(
'Not a valid matcher');
139 $key = array_search($filter, $this->submatchers,
true);
140 if ($key !==
false) {
141 unset($this->submatchers[$key]);
Interface to provide accessing objects as arrays.
$submatchers
Subfilters of this filter.
Interface for an event filter.
offsetSet($offset, $value)
Abstract class for a filter which groups several (sub-)filters together.
Classes implementing Countable can be used with the count() function.