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.

ArraySerializer::jsonSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Solvire\API\Serializers;
3
4
use Solvire\Utilities\OptionsChecker as Ch;
5
6
/**
7
 * Just map a static output
8
 * Methods are only GET
9
 *
10
 * @author solvire <[email protected]>
11
 * @package Serializers
12
 * @namespace Solvire\API\Serializers
13
 */
14
abstract class ArraySerializer extends BaseSerializer
15
{
16
17
    protected $methods = [
18
        'get'
19
    ];
20
21
    /**
22
     * (non-PHPdoc)
23
     * 
24
     * @see \Solvire\API\Serializers\BaseSerializer::jsonSerialize()
25
     */
26 2
    public function jsonSerialize()
27
    {
28 2
        return $this->toArray();
29
    }
30
31
    /**
32
     *
33
     * @return multitype:NULL
0 ignored issues
show
Documentation introduced by
The doc-type multitype:NULL could not be parsed: Unknown type name "multitype:NULL" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
34
     */
35 4
    public function toArray()
36
    {
37 4
        $ret = [];
38 4
        $dfc = $this->getDataFieldCollection();
39 4
        foreach ($dfc as $name => $obj) {
40 4
            $ret[$name] = $obj->getData();
41 4
        }
42
        
43 4
        return $ret;
44
    }
45
46
    /**
47
     *
48
     * @param array $data            
49
     */
50 4
    public function loadData($data)
51
    {
52 4
        Ch::ek($data, $this->requiredOptions);
53 4
        foreach ($data as $name => $value) {
54 4
            if (! ($df = $this->getField($name)))
55 4
                throw new \RuntimeException("field not set $name");
56
            
57 4
            $df->setData($value);
58 4
        }
59
        
60 4
        return $this;
61
    }
62
}