Skip to content

Commit

Permalink
冗長なif文を統合
Browse files Browse the repository at this point in the history
  • Loading branch information
shinya committed Sep 22, 2023
1 parent fd333d3 commit 41da667
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Eccube/EventListener/RateLimiterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ public function onController(ControllerEvent $event)
$factory = $this->locator->get($limiterId);
if (in_array('customer', $config['type']) || in_array('user', $config['type'])) {
$User = $this->requestContext->getCurrentUser();
if ($User instanceof Customer) {
$limiter = $factory->create($User->getId());
if (!$limiter->consume()->isAccepted()) {
throw new TooManyRequestsHttpException();
}
}
if ($User instanceof Member) {
if ($User instanceof Customer || $User instanceof Member) {
$limiter = $factory->create($User->getId());
if (!$limiter->consume()->isAccepted()) {
throw new TooManyRequestsHttpException();
Expand Down

0 comments on commit 41da667

Please sign in to comment.