ExceptionDetectionStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 15
ccs 8
cts 9
cp 0.8889
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isExceptionTransient() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace YucaDoo\GrazeNeighborhoodsDiagnostic;
6
7
use Exception;
8
use Graze\TransientFaultHandler\DetectionStrategy\ExceptionDetectionStrategyInterface;
9
use Neighborhoods\ThrowableDiagnosticComponent\DiagnosedInterface;
10
use Neighborhoods\ThrowableDiagnosticComponent\ThrowableDiagnostic;
11
12
class ExceptionDetectionStrategy implements ExceptionDetectionStrategyInterface
13
{
14 1
    use ThrowableDiagnostic\Builder\Factory\AwareTrait;
15
16 6
    public function isExceptionTransient(Exception $exception)
17
    {
18
        try {
19 6
            $this->getThrowableDiagnosticBuilderFactory()
20 6
                ->create()
21 6
                ->build()
22 6
                ->diagnose($exception);
23 6
        } catch (DiagnosedInterface $diagnosed) {
24 6
            return $diagnosed->isTransient();
25
        }
26
        return false;
27
    }
28
}
29