Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull 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

Sign up
Appearance settings

Commit17fb0fe

Browse files
[RateLimiter] AddRateLimiterFactoryInterface
1 parentbec056a commit17fb0fe

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
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
namespaceSymfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
useSymfony\Component\RateLimiter\RateLimiterFactory;
15+
useSymfony\Component\RateLimiter\RateLimiterFactoryInterface;
1516

1617
returnstaticfunction (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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* @author Wouter de Jong <wouter@wouterj.nl>
2626
*/
27-
finalclass RateLimiterFactory
27+
finalclass RateLimiterFactoryimplements RateLimiterFactoryInterface
2828
{
2929
privatearray$config;
3030

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

56-
protectedstaticfunctionconfigureOptions(OptionsResolver$options):void
56+
privatestaticfunctionconfigureOptions(OptionsResolver$options):void
5757
{
5858
$intervalNormalizer =staticfunction (Options$options,string$interval):\DateInterval {
5959
// Create DateTimeImmutable from unix timesatmp, so the default timezone is ignored and we don't need to
6060
// deal with quirks happening when modifying dates using a timezone with DST.
6161
$now = \DateTimeImmutable::createFromFormat('U',time());
6262

6363
try {
64-
$nowPlusInterval = @$now->modify('+' .$interval);
64+
$nowPlusInterval = @$now->modify('+'.$interval);
6565
}catch (\DateMalformedStringException$e) {
6666
thrownew \LogicException(\sprintf('Cannot parse interval "%s", please use a valid unit as described on https://www.php.net/datetime.formats.relative.',$interval),0,$e);
6767
}
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+
namespaceSymfony\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+
publicfunctioncreate(?string$key =null):LimiterInterface;
23+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp