Completed
Pull Request — master (#86)
by Luc
02:31
created

PromiseRetryEvaluator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A shouldRetry() 0 8 3
1
<?php
2
3
/*
4
 * This file is part of the Tolerance package.
5
 *
6
 * (c) Samuel ROZE <[email protected]>
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 Tolerance\Bridge\Guzzle\Operation\RetryEvaluator;
13
14
use GuzzleHttp\Psr7\Response;
15
use Tolerance\Operation\RetryEvaluator\RetryEvaluator;
16
17
class PromiseRetryEvaluator implements RetryEvaluator
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function shouldRetry($result)
23
    {
24
        if ($result instanceof Response && $result->getStatusCode() < 500) {
25
            return false;
26
        }
27
28
        return true;
29
    }
30
}
31