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

PayloadSerializer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 63.64%

Importance

Changes 6
Bugs 2 Features 0
Metric Value
wmc 4
c 6
b 2
f 0
lcom 1
cbo 2
dl 0
loc 25
ccs 7
cts 11
cp 0.6364
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 17 4
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\AdvancedSerializeInterface;
15
use CL\Slack\Payload\PayloadInterface;
16
17
/**
18
 * @author Cas Leentfaar <[email protected]>
19
 */
20
class PayloadSerializer extends AbstractSerializer
21
{
22
    /**
23
     * @param PayloadInterface $payload
24
     *
25
     * @return array The serialized payload data
26
     */
27 54
    public function serialize(PayloadInterface $payload)
28
    {
29 54
        if ($payload instanceof AdvancedSerializeInterface) {
30 1
            $payload->beforeSerialize($this->serializer);
31 1
        }
32
33 54
        $serializedPayload = $this->serializer->serialize($payload, 'json');
34
35 54
        if (!$serializedPayload || !is_string($serializedPayload)) {
36
            throw new \RuntimeException(sprintf(
37
                'Failed to serialize payload; expected it to be a string, got: %s',
38
                var_export($serializedPayload, true)
39
            ));
40
        }
41
42 54
        return json_decode($serializedPayload, true);
43
    }
44
}
45