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.

CompositeObjectUnserializer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/******************************************************************************
3
 * Copyright (c) 2017 Constantin Galbenu <[email protected]>             *
4
 ******************************************************************************/
5
6
namespace Gica\Serialize\ObjectHydrator\ObjectUnserializer;
7
8
9
use Gica\Serialize\ObjectHydrator\Exception\AdapterNotFoundException;
10
use Gica\Serialize\ObjectHydrator\Exception\ValueNotUnserializable;
11
use Gica\Serialize\ObjectHydrator\ObjectUnserializer;
12
13
class CompositeObjectUnserializer implements ObjectUnserializer
14
{
15
16
    /**
17
     * @var ObjectUnserializer[]
18
     */
19
    private $unserializers;
20
21 20
    public function __construct(
22
        array $unserializers = []
23
    )
24
    {
25 20
        $this->unserializers = $unserializers;
26 20
    }
27
28 8
    public function tryToUnserializeValue(string $objectClassName, $serializedValue)
29
    {
30 8
        foreach ($this->unserializers as $adapterLocator) {
31
            try {
32 4
                return $adapterLocator->tryToUnserializeValue($objectClassName, $serializedValue);
33 4
            } catch (AdapterNotFoundException $exception) {
34 1
                continue;
35 4
            } catch (ValueNotUnserializable $exception) {
36 4
                continue;
37
            }
38
        }
39
40 6
        throw new AdapterNotFoundException(
41 6
            sprintf("None of the %d adapter locators could find an adapter", count($this->unserializers)));
42
    }
43
}