app = $app; } public function get(WebhookEvent $event) { switch ($event->getType()) { case WebhookEvent::FEED_ENTRY_TYPE: return new FeedEntryProcessor($this->app); case WebhookEvent::USER_REGISTRATION_TYPE: return new UserRegistrationProcessor($this->app, $this->app['repo.users']); default: throw new \RuntimeException(sprintf('No processor found for %s', $event->getType())); } } }