Kahlan\Plugin\Stub::methods PHP Méthode

methods() public méthode

Getd/Setd stubs for methods or get stubbed methods array.
public methods ( array $name = [] ) : Method[]
$name array An array of method names.
Résultat Kahlan\Plugin\Stub\Method[] Return the array of stubbed methods.
    public function methods($name = [])
    {
        if (!func_num_args()) {
            return $this->_methods;
        }
        foreach ($name as $method => $returns) {
            if (is_callable($returns)) {
                $this->method($method, $returns);
            } elseif (is_array($returns)) {
                $stub = $this->method($method);
                call_user_func_array([$stub, 'andReturn'], $returns);
            } else {
                $error = "Stubbed method definition for `{$method}` must be a closure or an array of returned value(s).";
                throw new InvalidArgumentException($error);
            }
        }
    }