src/ArrayContainsComparator.php
public function addFunction($name, $callback) {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException(sprintf(
                'Callback provided for function "%s" is not callable.',
                $name
            ));
        }

        $this->functions[$name] = $callback;

        return $this;
    }
public function addFunction($name, $callback) {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException(sprintf(
                'Callback provided for function "%s" is not callable.',
                $name
            ));
        }

        $this->functions[$name] = $callback;

        return $this;
    }
public function addFunction ( $ name , $ callback ) { if ( ! is_callable ( $ callback ) ) { throw new InvalidArgumentException ( sprintf ( 'Callback provided for function "%s" is not callable.' , $ name ) ) ; } $ this -> functions [ $ name ] = $ callback ; return $ this ; }
Add a custom matcher function

If an existing function exists with the same name it will be replaced

@param string $name The name of the function, for instance "length"
@param callable $callback The piece of callback code
@throws InvalidArgumentException Throws an exception if the callback is not callable
@return self
Add a custom matcher function