diff --git a/src/Resources/config/verify_email_services.xml b/config/verify_email_services.xml similarity index 95% rename from src/Resources/config/verify_email_services.xml rename to config/verify_email_services.xml index 80cb3c0..fd8b477 100644 --- a/src/Resources/config/verify_email_services.xml +++ b/config/verify_email_services.xml @@ -2,7 +2,7 @@ diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php deleted file mode 100644 index b272335..0000000 --- a/src/DependencyInjection/Configuration.php +++ /dev/null @@ -1,38 +0,0 @@ - - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace SymfonyCasts\Bundle\VerifyEmail\DependencyInjection; - -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\ConfigurationInterface; - -/** - * @author Jesse Rushlow - * @author Ryan Weaver - */ -class Configuration implements ConfigurationInterface -{ - public function getConfigTreeBuilder(): TreeBuilder - { - $treeBuilder = new TreeBuilder('symfonycasts_verify_email'); - /** @var ArrayNodeDefinition $rootNode */ - $rootNode = $treeBuilder->getRootNode(); - - $rootNode /** @phpstan-ignore-line method.notFound (The last end() call) */ - ->children() - ->integerNode('lifetime') - ->defaultValue(3600) - ->info('The length of time in seconds that a signed URI is valid for after it is created.') - ->end() - ->end(); - - return $treeBuilder; - } -} diff --git a/src/DependencyInjection/SymfonyCastsVerifyEmailExtension.php b/src/DependencyInjection/SymfonyCastsVerifyEmailExtension.php deleted file mode 100644 index 21392ad..0000000 --- a/src/DependencyInjection/SymfonyCastsVerifyEmailExtension.php +++ /dev/null @@ -1,43 +0,0 @@ - - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace SymfonyCasts\Bundle\VerifyEmail\DependencyInjection; - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; - -/** - * @author Jesse Rushlow - * @author Ryan Weaver - */ -final class SymfonyCastsVerifyEmailExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container): void - { - $loader = new XmlFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config')); - $loader->load('verify_email_services.xml'); - - $configuration = $this->getConfiguration($configs, $container); - if (!$configuration) { - throw new \Exception('Configuration is not expected to be null'); - } - - $config = $this->processConfiguration($configuration, $configs); - - $helperDefinition = $container->getDefinition('symfonycasts.verify_email.helper'); - $helperDefinition->replaceArgument(3, $config['lifetime']); - } - - public function getAlias(): string - { - return 'symfonycasts_verify_email'; - } -} diff --git a/src/SymfonyCastsVerifyEmailBundle.php b/src/SymfonyCastsVerifyEmailBundle.php index 8f6d640..7909789 100644 --- a/src/SymfonyCastsVerifyEmailBundle.php +++ b/src/SymfonyCastsVerifyEmailBundle.php @@ -9,22 +9,38 @@ namespace SymfonyCasts\Bundle\VerifyEmail; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\HttpKernel\Bundle\Bundle; -use SymfonyCasts\Bundle\VerifyEmail\DependencyInjection\SymfonyCastsVerifyEmailExtension; +use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symfony\Component\HttpKernel\Bundle\AbstractBundle; /** * @author Jesse Rushlow * @author Ryan Weaver */ -class SymfonyCastsVerifyEmailBundle extends Bundle +class SymfonyCastsVerifyEmailBundle extends AbstractBundle { - public function getContainerExtension(): ?ExtensionInterface + protected string $extensionAlias = 'symfonycasts_verify_email'; + + public function configure(DefinitionConfigurator $definition): void + { + $definition->rootNode() /** @phpstan-ignore method.notFound */ + ->children() + ->integerNode('lifetime') + ->defaultValue(3600) + ->info('The length of time in seconds that a signed URI is valid for after it is created.') + ->end() + ; + } + + /** @param array $config */ + public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void { - if (!$this->extension) { - $this->extension = new SymfonyCastsVerifyEmailExtension(); - } + $container->import('../config/verify_email_services.xml'); - return $this->extension; + $container->services() + ->get('symfonycasts.verify_email.helper') + ->arg(3, $config['lifetime']) + ; } } diff --git a/src/Resources/translations/VerifyEmailBundle+intl-icu.nl.xlf b/translations/VerifyEmailBundle+intl-icu.nl.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle+intl-icu.nl.xlf rename to translations/VerifyEmailBundle+intl-icu.nl.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.ar.xlf b/translations/VerifyEmailBundle.ar.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.ar.xlf rename to translations/VerifyEmailBundle.ar.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.ca.xlf b/translations/VerifyEmailBundle.ca.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.ca.xlf rename to translations/VerifyEmailBundle.ca.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.cs.xlf b/translations/VerifyEmailBundle.cs.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.cs.xlf rename to translations/VerifyEmailBundle.cs.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.da.xlf b/translations/VerifyEmailBundle.da.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.da.xlf rename to translations/VerifyEmailBundle.da.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.de.xlf b/translations/VerifyEmailBundle.de.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.de.xlf rename to translations/VerifyEmailBundle.de.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.el.xlf b/translations/VerifyEmailBundle.el.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.el.xlf rename to translations/VerifyEmailBundle.el.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.en.xlf b/translations/VerifyEmailBundle.en.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.en.xlf rename to translations/VerifyEmailBundle.en.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.es.xlf b/translations/VerifyEmailBundle.es.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.es.xlf rename to translations/VerifyEmailBundle.es.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.fa.xlf b/translations/VerifyEmailBundle.fa.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.fa.xlf rename to translations/VerifyEmailBundle.fa.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.fi.xlf b/translations/VerifyEmailBundle.fi.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.fi.xlf rename to translations/VerifyEmailBundle.fi.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.fr.xlf b/translations/VerifyEmailBundle.fr.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.fr.xlf rename to translations/VerifyEmailBundle.fr.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.hu.xlf b/translations/VerifyEmailBundle.hu.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.hu.xlf rename to translations/VerifyEmailBundle.hu.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.id.xlf b/translations/VerifyEmailBundle.id.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.id.xlf rename to translations/VerifyEmailBundle.id.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.it.xlf b/translations/VerifyEmailBundle.it.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.it.xlf rename to translations/VerifyEmailBundle.it.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.ja.xlf b/translations/VerifyEmailBundle.ja.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.ja.xlf rename to translations/VerifyEmailBundle.ja.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.mk.xlf b/translations/VerifyEmailBundle.mk.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.mk.xlf rename to translations/VerifyEmailBundle.mk.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.mn.xlf b/translations/VerifyEmailBundle.mn.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.mn.xlf rename to translations/VerifyEmailBundle.mn.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.pl.xlf b/translations/VerifyEmailBundle.pl.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.pl.xlf rename to translations/VerifyEmailBundle.pl.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.pt.xlf b/translations/VerifyEmailBundle.pt.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.pt.xlf rename to translations/VerifyEmailBundle.pt.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.ro.xlf b/translations/VerifyEmailBundle.ro.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.ro.xlf rename to translations/VerifyEmailBundle.ro.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.ru.xlf b/translations/VerifyEmailBundle.ru.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.ru.xlf rename to translations/VerifyEmailBundle.ru.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.sk.xlf b/translations/VerifyEmailBundle.sk.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.sk.xlf rename to translations/VerifyEmailBundle.sk.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.sr.xlf b/translations/VerifyEmailBundle.sr.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.sr.xlf rename to translations/VerifyEmailBundle.sr.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.tr.xlf b/translations/VerifyEmailBundle.tr.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.tr.xlf rename to translations/VerifyEmailBundle.tr.xlf diff --git a/src/Resources/translations/VerifyEmailBundle.uk.xlf b/translations/VerifyEmailBundle.uk.xlf similarity index 100% rename from src/Resources/translations/VerifyEmailBundle.uk.xlf rename to translations/VerifyEmailBundle.uk.xlf