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.

Arrayable   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 8

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArrayHyphen() 0 14 5
A toArray() 0 7 3
1
<?php
2
3
namespace Soheilrt\AdobeConnectClient\Client\Traits;
4
5
use Soheilrt\AdobeConnectClient\Client\Helpers\StringCaseTransform as SCT;
6
use Soheilrt\AdobeConnectClient\Client\Helpers\ValueTransform as VT;
7
8
/**
9
 * Override the methods to turn into a valid ArrayableInterface.
10
 */
11
trait Arrayable
12
{
13
    /**
14
     * Retrieves all not null attributes in an associative array.
15
     *
16
     * The keys in hash style: Ex: is-member
17
     * The values as string
18
     *
19
     * @param bool $trimNull remove null values from array
20
     *
21
     * @return string[][]
22
     */
23
    public function toArray($trimNull = true): array
24
    {
25
        if (isset($this->attributes) && is_array($this->attributes)) {
26
            return $this->toArrayHyphen($this->attributes, $trimNull);
27
        }
28
29
        return $this->toArrayHyphen($this, $trimNull);
30
    }
31
32
    private function toArrayHyphen($array, $trimNull): array
33
    {
34
        $hyphen_array = [];
35
        foreach ($array as $key => $value) {
36
            if ($trimNull && !isset($value)) {
37
                continue;
38
            } elseif (is_array($value)) {
39
                $hyphen_array[SCT::toHyphen($key)] = $this->toArrayHyphen($value, $trimNull);
40
            } else {
41
                $hyphen_array[SCT::toHyphen($key)] = VT::toString($value);
42
            }
43
        }
44
45
        return $hyphen_array;
46
    }
47
}
48