Files
Phraseanet/lib/Alchemy/Phrasea/Webhook/EventProcessorFactory.php
Nicolas Le Goff 24b885eb7c Fix tests
2014-07-03 15:07:35 +02:00

29 lines
686 B
PHP

<?php
namespace Alchemy\Phrasea\Webhook;
use Alchemy\Phrasea\Model\Entities\WebhookEvent;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Webhook\Processor\FeedEntryProcessor;
class EventProcessorFactory
{
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function get(WebhookEvent $event)
{
switch ($event->getType()) {
case WebhookEvent::FEED_ENTRY_TYPE:
return new FeedEntryProcessor($event, $this->app);
break;
default:
throw new \RuntimeException(sprintf('No processor found for %s', $event->getType()));
}
}
}