/** * @param mixed[] $headers * @param string $body */ public function handle(array $headers, $body) { if (!$this->firewall->authorize($headers, $body)) { throw new BadRequestHttpException('The request signature is not valid.'); } if (!is_array($payload = json_decode($body, true))) { throw new BadRequestHttpException('The request json body cannot be decoded.'); } $this->eventDispatcher->dispatch(WebhookEvents::HOOK, $event = new WebhookEvent($payload)); foreach ($event->getProcesses() as $process) { $this->processProducer->publish($process); } }
public function testAddProcess() { $this->event->addProcess($process = $this->createProcessMock()); $this->assertSame([$process], $this->event->getProcesses()); }