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.

PayloadResponseSerializer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 58.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 27
c 0
b 0
f 0
ccs 7
cts 12
cp 0.5833
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A deserialize() 0 18 3
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 114
    public function deserialize(array $payloadResponse, $payloadResponseClass)
28
    {
29 114
        $payloadResponseObject = $this->serializer->deserialize(
30 114
            json_encode($payloadResponse),
31 114
            $payloadResponseClass,
32
            'json'
33 114
        );
34
35 114
        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 114
        return $payloadResponseObject;
44
    }
45
}
46