Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\SmsBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class SmsTransportPass implements CompilerPassInterface
|
||||
{
|
||||
private ?ContainerBuilder $container = null;
|
||||
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
$this->registerTransports();
|
||||
$this->registerCallbacks();
|
||||
}
|
||||
|
||||
private function registerTransports(): void
|
||||
{
|
||||
if (!$this->container->has('mautic.sms.transport_chain')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $this->container->getDefinition('mautic.sms.transport_chain');
|
||||
$taggedServices = $this->container->findTaggedServiceIds('mautic.sms_transport');
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$definition->addMethodCall('addTransport', [
|
||||
$id,
|
||||
new Reference($id),
|
||||
!empty($tags[0]['alias']) ? $tags[0]['alias'] : $id,
|
||||
!empty($tags[0]['integrationAlias']) ? $tags[0]['integrationAlias'] : $id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function registerCallbacks(): void
|
||||
{
|
||||
if (!$this->container->has('mautic.sms.callback_handler_container')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $this->container->getDefinition('mautic.sms.callback_handler_container');
|
||||
$taggedServices = $this->container->findTaggedServiceIds('mautic.sms_callback_handler');
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$definition->addMethodCall('registerHandler', [
|
||||
new Reference($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\SmsBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
|
||||
class MauticSmsExtension extends Extension
|
||||
{
|
||||
/**
|
||||
* @param mixed[] $configs
|
||||
*/
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Config'));
|
||||
$loader->load('services.php');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user