GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 42df07...9ca54b )
by Baptiste
02:11
created

Delegate::__invoke()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
crap 3
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Transport\Protocol\ArgumentTranslator;
5
6
use Innmind\AMQP\{
7
    Transport\Protocol\ArgumentTranslator,
8
    Transport\Frame\Value,
9
    Exception\ValueNotTranslatable
10
};
11
12
final class Delegate implements ArgumentTranslator
13
{
14
    private $translators;
15
16 3
    public function __construct(ArgumentTranslator ...$translators)
17
    {
18 3
        $this->translators = $translators;
19 3
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 2
    public function __invoke($value): Value
25
    {
26 2
        foreach ($this->translators as $translate) {
27
            try {
28 2
                return $translate($value);
29 2
            } catch (ValueNotTranslatable $e) {
30
                //pass
31
            }
32
        }
33
34 1
        throw new ValueNotTranslatable($value);
35
    }
36
}
37