Skip to content

Commit

Permalink
minor #312 use new bundle structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow authored Apr 27, 2024
1 parent b15e3a1 commit 23c7cb4
Show file tree
Hide file tree
Showing 27 changed files with 44 additions and 108 deletions.
File renamed without changes.
49 changes: 0 additions & 49 deletions src/DependencyInjection/Configuration.php

This file was deleted.

50 changes: 0 additions & 50 deletions src/DependencyInjection/SymfonyCastsResetPasswordExtension.php

This file was deleted.

53 changes: 44 additions & 9 deletions src/SymfonyCastsResetPasswordBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,57 @@

namespace SymfonyCasts\Bundle\ResetPassword;

use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use SymfonyCasts\Bundle\ResetPassword\DependencyInjection\SymfonyCastsResetPasswordExtension;
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;

/**
* @author Jesse Rushlow <[email protected]>
* @author Ryan Weaver <[email protected]>
*/
class SymfonyCastsResetPasswordBundle extends Bundle
class SymfonyCastsResetPasswordBundle extends AbstractBundle
{
public function getContainerExtension(): ?ExtensionInterface
protected string $extensionAlias = 'symfonycasts_reset_password';

public function configure(DefinitionConfigurator $definition): void
{
$definition->rootNode() /** @phpstan-ignore method.notFound */
->children()
->scalarNode('request_password_repository')
->isRequired()
->info('A class that implements ResetPasswordRequestRepositoryInterface - usually your ResetPasswordRequestRepository.')
->end()
->integerNode('lifetime')
->defaultValue(3600)
->info('The length of time in seconds that a password reset request is valid for after it is created.')
->end()
->integerNode('throttle_limit')
->defaultValue(3600)
->info('Another password reset cannot be made faster than this throttle time in seconds.')
->end()
->booleanNode('enable_garbage_collection')
->defaultValue(true)
->info('Enable/Disable automatic garbage collection.')
->end()
->end()
;
}

/** @param array<string, string|int|bool> $config */
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
{
if (null === $this->extension) {
$this->extension = new SymfonyCastsResetPasswordExtension();
}
$container->import('../config/reset_password_services.xml');

return $this->extension ?: null;
$container->services()
->get('symfonycasts.reset_password.helper')
->arg(2, new Reference((string) $config['request_password_repository']))
->arg(3, $config['lifetime'])
->arg(4, $config['throttle_limit'])
->get('symfonycasts.reset_password.cleaner')
->arg(0, new Reference((string) $config['request_password_repository']))
->arg(1, $config['enable_garbage_collection'])
;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 23c7cb4

Please sign in to comment.