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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 12 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