RetryStrategyFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 11
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 4
1
<?php
2
3
namespace Tarantool\JobQueue\Handler\RetryStrategy;
4
5
use Tarantool\JobQueue\JobBuilder\RetryStrategies;
6
7
class RetryStrategyFactory
8
{
9
    public function create(string $strategy, array $args = []): RetryStrategy
10
    {
11 3
        switch ($strategy) {
12
            case RetryStrategies::CONSTANT: return new ConstantRetryStrategy(...$args);
0 ignored issues
show
Bug introduced by
$args is expanded, but the parameter $interval of Tarantool\JobQueue\Handl...Strategy::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

12
            case RetryStrategies::CONSTANT: return new ConstantRetryStrategy(/** @scrutinizer ignore-type */ ...$args);
Loading history...
13
            case RetryStrategies::EXPONENTIAL: return new ExponentialRetryStrategy(...$args);
0 ignored issues
show
Bug introduced by
$args is expanded, but the parameter $base of Tarantool\JobQueue\Handl...Strategy::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

13
            case RetryStrategies::EXPONENTIAL: return new ExponentialRetryStrategy(/** @scrutinizer ignore-type */ ...$args);
Loading history...
14 3
            case RetryStrategies::LINEAR: return new LinearRetryStrategy(...$args);
0 ignored issues
show
Bug introduced by
$args is expanded, but the parameter $step of Tarantool\JobQueue\Handl...Strategy::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

14
            case RetryStrategies::LINEAR: return new LinearRetryStrategy(/** @scrutinizer ignore-type */ ...$args);
Loading history...
15 2
        }
16 1
17
        throw new \InvalidArgumentException(sprintf('Unknown retry strategy "%s".', $strategy));
18
    }
19
}
20