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 — master ( 9be716...8dfb79 )
by Cas
10:46 queued 07:19
created

PayloadResponseSerializer::deserialize()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3.6511

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 18
ccs 7
cts 12
cp 0.5833
rs 9.4285
cc 3
eloc 11
nc 2
nop 2
crap 3.6511
1
<?php
2
3
/*
4
 * This file is part of the Slack API library.
5
 *
6
 * (c) Cas Leentfaar <[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 CL\Slack\Serializer;
13
14
use CL\Slack\Payload\PayloadResponseInterface;
15
16
/**
17
 * @author Cas Leentfaar <[email protected]>
18
 */
19
class PayloadResponseSerializer extends AbstractSerializer
20
{
21
    /**
22
     * @param array  $payloadResponse
23
     * @param string $payloadResponseClass
24
     *
25
     * @return PayloadResponseInterface
26
     */
27 53
    public function deserialize(array $payloadResponse, $payloadResponseClass)
28
    {
29 53
        $payloadResponseObject = $this->serializer->deserialize(
30 53
            json_encode($payloadResponse),
31 53
            $payloadResponseClass,
32
            'json'
33 53
        );
34
35 53
        if (!($payloadResponseObject instanceof PayloadResponseInterface)) {
36
            throw new \RuntimeException(sprintf(
37
                'The serializer expected the response data to be converted into an instance of "%s", got: %s',
38
                $payloadResponseClass,
39
                is_object($payloadResponseObject) ? 'instance of ' . get_class($payloadResponseObject) : gettype($payloadResponseObject)
40
            ));
41
        }
42
43 53
        return $payloadResponseObject;
44
    }
45
}
46