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.

JsonSerializable::jsonSerialize()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 7
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
namespace Halfpastfour\PHPChartJS\Delegate;
4
5
use Halfpastfour\PHPChartJS\ArraySerializableInterface;
6
use JsonSerializable as JsonSerializableInterface;
7
8
/**
9
 * Trait JsonSerializable
10
 *
11
 * @package Halfpastfour\PHPChartJS\Delegate
12
 */
13
trait JsonSerializable
14
{
15
    /**
16
     * @return array
17
     */
18
    public function jsonSerialize()
19
    {
20
        return array_map(function ($value) {
21
            if ($value instanceof JsonSerializableInterface) {
22
                return $value->jsonSerialize();
23
            } elseif ($value instanceof ArraySerializableInterface) {
24
                return $value->getArrayCopy();
25
            }
26
27
            return $value;
28
        }, $this->getArrayCopy());
29
    }
30
31
    /**
32
     * @return array
33
     */
34
    abstract public function getArrayCopy();
35
}
36