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
Pull Request — master (#61)
by halfpastfour
03:01
created

JsonSerializable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 16
rs 10
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());
0 ignored issues
show
Bug introduced by
It seems like getArrayCopy() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
        }, $this->/** @scrutinizer ignore-call */ getArrayCopy());
Loading history...
29
    }
30
}
31