public function return($result)
    {
        if (!$result instanceof ResponseInterface && !is_callable($result)) {
            throw InvalidArgumentException::withExpectedType(
                $this,
                'return',
                1,
                sprintf('an instance of %s or a callable', ResponseInterface::class),
                $result
            );
        }

        $this->result = $result;

        return $this;
    }
public function return($result)
    {
        if (!$result instanceof ResponseInterface && !is_callable($result)) {
            throw InvalidArgumentException::withExpectedType(
                $this,
                'return',
                1,
                sprintf('an instance of %s or a callable', ResponseInterface::class),
                $result
            );
        }

        $this->result = $result;

        return $this;
    }
public function return ( $ result ) { if ( ! $ result instanceof ResponseInterface && ! is_callable ( $ result ) ) { throw InvalidArgumentException :: withExpectedType ( $ this , 'return' , 1 , sprintf ( 'an instance of %s or a callable' , ResponseInterface :: class ) , $ result ) ; } $ this -> result = $ result ; return $ this ; }
Defines the result for the current matching layer.

If the result is a callable, it must accept a {@see RequestInterface} as first parameter and return an instance
of {@see ResponseInterface}.

@param ResponseInterface|callable $result

@throws InvalidArgumentException

@return $this
Defines the result for the current matching layer .