Initial commit: CloudOps infrastructure platform

This commit is contained in:
root
2026-04-09 19:58:57 +02:00
commit 1166a52f26
7762 changed files with 839452 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Mautic\SmsBundle\Callback;
use Doctrine\Common\Collections\ArrayCollection;
use Mautic\SmsBundle\Exception\NumberNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
interface CallbackInterface
{
/**
* Returns a "transport" string to match the URL path /sms/{transport}/callback.
*
* @return string
*/
public function getTransportName();
/**
* Return all contacts that match whatever identifiers the service provides (likely number).
*
* @return ArrayCollection
*
* @throws NumberNotFoundException
* @throws BadRequestHttpException
* @throws NotFoundHttpException
*/
public function getContacts(Request $request);
/**
* Extract the message in the reply from the request.
*
* @return string
*
* @throws BadRequestHttpException
* @throws NotFoundHttpException
*/
public function getMessage(Request $request);
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Mautic\SmsBundle\Callback;
use Mautic\SmsBundle\Exception\CallbackHandlerNotFound;
class HandlerContainer
{
/**
* @var CallbackInterface[]
*/
private ?array $handlers = null;
public function registerHandler(CallbackInterface $handler): void
{
$this->handlers[$handler->getTransportName()] = $handler;
}
/**
* @return CallbackInterface
*
* @throws CallbackHandlerNotFound
*/
public function getHandler($transportName)
{
if (!isset($this->handlers[$transportName])) {
throw new CallbackHandlerNotFound("$transportName has not been registered");
}
return $this->handlers[$transportName];
}
}