Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Mautic\EmailBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
class StatHelperPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
$definition = $container->getDefinition('mautic.email.stats.helper_container');
|
||||
$taggedServices = $container->findTaggedServiceIds('mautic.email_stat_helper');
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$definition->addMethodCall('addHelper', [
|
||||
new Reference($id),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\EmailBundle\DependencyInjection\EnvProcessor;
|
||||
|
||||
use Mautic\CoreBundle\Helper\Dsn\Dsn;
|
||||
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
|
||||
|
||||
class MailerDsnEnvVarProcessor implements EnvVarProcessorInterface
|
||||
{
|
||||
public function getEnv(string $prefix, string $name, \Closure $getEnv): string
|
||||
{
|
||||
$env = $getEnv($name);
|
||||
try {
|
||||
Dsn::fromString($env);
|
||||
|
||||
return str_replace('%%', '%', $env);
|
||||
} catch (\InvalidArgumentException) {
|
||||
return 'invalid://null';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getProvidedTypes(): array
|
||||
{
|
||||
return [
|
||||
'mailer' => 'string',
|
||||
'urlencoded-dsn' => 'string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\EmailBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
|
||||
class MauticEmailExtension 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