8000 [RateLimiter] Add `RateLimiterFactoryInterface` · symfony/symfony@2bd3a61 · GitHub
[go: up one dir, main page]

Skip to content
  • Pricing
  • Search code, repositories, users, issues, pu 8000 ll requests...

    Provide feedback

    We read every piece of feedback, and take your input very seriously.

    Saved searches

    Use saved searches to filter your results more quickly

    Appearance settings

    Commit 2bd3a61

    Browse files
    [RateLimiter] Add RateLimiterFactoryInterface
    1 parent bec056a commit 2bd3a61

    File tree

    5 files changed

    +38
    -2
    lines changed

    5 files changed

    +38
    -2
    lines changed

    src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,11 @@
    11
    CHANGELOG
    22
    =========
    33

    4+
    7.3
    5+
    ---
    6+
    7+
    * Add `RateLimiterFactoryInterface` as an alias of the `limiter` service
    8+
    49
    7.2
    510
    ---
    611

    src/Symfony/Bundle/FrameworkBundle/Resources/config/rate_limiter.php

    Lines changed: 3 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,6 +12,7 @@
    1212
    namespace Symfony\Component\DependencyInjection\Loader\Configurator;
    1313

    1414
    use Symfony\Component 8000 \RateLimiter\RateLimiterFactory;
    15+
    use Symfony\Component\RateLimiter\RateLimiterFactoryInterface;
    1516

    1617
    return static function (ContainerConfigurator $container) {
    1718
    $container->services()
    @@ -26,5 +27,7 @@
    2627
    abstract_arg('storage'),
    2728
    null,
    2829
    ])
    30+
    31+
    ->alias(RateLimiterFactoryInterface::class, 'limiter')
    2932
    ;
    3033
    };

    src/Symfony/Component/RateLimiter/CHANGELOG.md

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,6 +1,11 @@
    11
    CHANGELOG
    22
    =========
    33

    4+
    7.3
    5+
    ---
    6+
    7+
    * Add `RateLimiterFactoryInterface`
    8+
    49
    6.4
    510
    ---
    611

    src/Symfony/Component/RateLimiter/RateLimiterFactory.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -24,7 +24,7 @@
    2424
    /**
    2525
    * @author Wouter de Jong <wouter@wouterj.nl>
    2626
    */
    27-
    final class RateLimiterFactory
    27+
    final class RateLimiterFactory implements RateLimiterFactoryInterface
    2828
    {
    2929
    private array $config;
    3030

    @@ -53,7 +53,7 @@ public function create(?string $key = null): LimiterInterface
    5353
    };
    5454
    }
    5555

    56-
    protected static function configureOptions(OptionsResolver $options): void
    56+
    private static function configureOptions(OptionsResolver $options): void
    5757
    {
    5858
    $intervalNormalizer = static function (Options $options, string $interval): \DateInterval {
    5959
    // Create DateTimeImmutable from unix timesatmp, so the default timezone is ignored and we don't need to
    Lines changed: 23 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,23 @@
    1+
    <?php
    2+
    3+
    /*
    4+
    * This file is part of the Symfony package.
    5+
    *
    6+
    * (c) Fabien Potencier <fabien@symfony.com>
    7+
    *
    8+
    * For the full copyright and license information, please view the LICENSE
    9+
    * file that was distributed with this source code.
    10+
    */
    11+
    12+
    namespace Symfony\Component\RateLimiter;
    13+
    14+
    /**
    15+
    * @author Alexandre Daubois <alex.daubois@gmail.com>
    16+
    */
    17+
    interface RateLimiterFactoryInterface
    18+
    {
    19+
    /**
    20+
    * @param string|null $key An optional key used to identify the limiter.
    21+
    */
    22+
    public function create(?string $key = null): LimiterInterface;
    23+
    }

    0 commit comments

    Comments
     (0)
    0