/** * {@inheritdoc} */ public function resolve(MessageInterface $message) { $nameOfMessage = $this->nameOfMessageResolver->resolve($message); $handler = $this->getHandlerFor($nameOfMessage); $handlerMethodName = $this->getHandlerMethodFor($nameOfMessage); if (!method_exists($handler, $handlerMethodName)) { throw NotFoundException::methodForObject($handler, $handlerMethodName); } return Delegate::fromMethod($handler, $handlerMethodName); }
/** * Test methodForObject method. */ public function testMethodForObject() { $this->given($exception = NotFoundException::methodForObject('foo', 'bar'))->then()->variable($exception->getPrevious())->isNull(); }