Matcher/Pattern.php
public function withCallback(callable $theCallback)
    {
        $copy = clone $this;
        foreach ($this->states as $key => $s) {
            foreach ($s->conditions as $c) {
                if ($c->nextState === State::MATCH_FOUND) {
                    $copy->callbacks[$key][State::MATCH_FOUND] = $theCallback;
                }
            }
        }
        return $copy;
    }
public function withCallback(callable $theCallback)
    {
        $copy = clone $this;
        foreach ($this->states as $key => $s) {
            foreach ($s->conditions as $c) {
                if ($c->nextState === State::MATCH_FOUND) {
                    $copy->callbacks[$key][State::MATCH_FOUND] = $theCallback;
                }
            }
        }
        return $copy;
    }
public function withCallback ( callable $ theCallback ) { $ copy = clone $ this ; foreach ( $ this -> states as $ key => $ s ) { foreach ( $ s -> conditions as $ c ) { if ( $ c -> nextState === State :: MATCH_FOUND ) { $ copy -> callbacks [ $ key ] [ State :: MATCH_FOUND ] = $ theCallback ; } } } return $ copy ; }
Set the pattern's match callback

@param \callable $theCallback
Set the pattern s match callback