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.

ArraySerializable::getArrayCopy()   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
cc 4
eloc 9
c 6
b 0
f 1
nc 1
nop 0
dl 0
loc 16
rs 9.9666
1
<?php
2
3
namespace Halfpastfour\PHPChartJS\Delegate;
4
5
use Halfpastfour\PHPChartJS\ArraySerializableInterface;
6
7
/**
8
 * Class ArraySerializable
9
 *
10
 * @package Halfpastfour\PHPChartJS\Model
11
 */
12
trait ArraySerializable
13
{
14
    /**
15
     * Returns an array copy of the properties and their current values in this class
16
     *
17
     * @return array
18
     */
19
    public function getArrayCopy()
20
    {
21
        $currentValues = array_map(function ($value) {
22
            if (is_object($value)) {
23
                if ($value instanceof ArraySerializableInterface) {
24
                    return $value->getArrayCopy();
25
                }
26
            }
27
28
            return $value;
29
        }, get_object_vars($this));
30
31
        // Filter out null values and return the remaining.
32
        return array_filter($currentValues, function ($value, $key) {
33
            return ! is_null($value) && $key !== 'owner';
34
        }, ARRAY_FILTER_USE_BOTH);
35
    }
36
}
37