mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
29 lines
686 B
PHP
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()));
|
|
}
|
|
}
|
|
}
|