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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 2
b 0
f 1
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 11 3
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