Skip to content

Commit 456cfca

Browse files
author
Miguel Manso
committed
After some testing preg_match won as the fastest way to test this.
1 parent a0a649d commit 456cfca

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/DependencyInjection/UecodeQPushExtension.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ class UecodeQPushExtension extends Extension
4242
* @param array $configs
4343
* @param ContainerBuilder $container
4444
*
45-
* @throws Exception
46-
* @throws RuntimeException
47-
* @throws InvalidArgumentException
48-
* @throws ServiceNotFoundException
45+
* @throws RuntimeException|InvalidArgumentException|ServiceNotFoundException
4946
*/
5047
public function load(array $configs, ContainerBuilder $container)
5148
{
@@ -138,9 +135,8 @@ public function load(array $configs, ContainerBuilder $container)
138135
]
139136
);
140137

141-
$reversedQueueName = strrev($values['options']['queue_name']);
142-
$isQueueNameFIFOReady = strpos($reversedQueueName, 'ofif.') === 0;
143-
138+
// Check queue name ends with ".fifo"
139+
$isQueueNameFIFOReady = preg_match("/$(?<=(\.fifo))/", $values['options']['queue_name']) === 1;
144140
if ($values['options']['fifo'] === true && !$isQueueNameFIFOReady) {
145141
throw new InvalidArgumentException('Queue name must end with ".fifo" on AWS FIFO queues');
146142
}

0 commit comments

Comments
 (0)