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.

Model   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 70
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A get() 0 7 2
A __call() 0 7 2
A all() 0 4 1
A getApi() 0 4 1
1
<?php
2
3
namespace Choccybiccy\HumanApi;
4
5
/**
6
 * Class Model
7
 * @package Choccybiccy\HumanApi
8
 */
9
class Model
10
{
11
12
    /**
13
     * @var array
14
     */
15
    protected $data;
16
17
    /**
18
     * @var Api
19
     */
20
    protected $api;
21
22
    /**
23
     * Constructor
24
     *
25
     * @param array $data
26
     * @param Api $api
27
     */
28
    public function __construct(array $data, Api $api = null)
29
    {
30
        $this->data = $data;
31
        $this->api = $api;
32
    }
33
34
    /**
35
     * Get data
36
     *
37
     * @param string $key
38
     * @return mixed|null
39
     */
40
    public function get($key)
41
    {
42
        if (array_key_exists($key, $this->data)) {
43
            return $this->data[$key];
44
        }
45
        return null;
46
    }
47
48
    /**
49
     * @param string $method
50
     * @param array $arguments
51
     * @return mixed
52
     */
53
    public function __call($method, $arguments)
54
    {
55
        if (preg_match("/get([A-Z]{1}([A-Za-z]+))/is", $method, $match)) {
56
            $key = lcfirst($match[1]);
57
            return $this->get($key);
58
        }
59
    } // @codeCoverageIgnore
60
61
    /**
62
     * Get data as array
63
     *
64
     * @return array
65
     */
66
    public function all()
67
    {
68
        return $this->data;
69
    }
70
71
    /**
72
     * @return Api
73
     */
74
    public function getApi()
75
    {
76
        return $this->api;
77
    }
78
}
79