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

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 49
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 4 1
A toArray() 0 10 2
A loadData() 0 12 3
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
}