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

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
eloc 10
c 6
b 0
f 1
dl 0
loc 23
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getArrayCopy() 0 16 4
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