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.

Api   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 60
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildCollection() 0 14 4
A buildUrlParts() 0 12 1
1
<?php
2
3
namespace Choccybiccy\HumanApi;
4
5
use GuzzleHttp\Client;
6
7
/**
8
 * Class Api
9
 * @package Choccybiccy\HumanApi
10
 */
11
abstract class Api extends Client
12
{
13
14
    /**
15
     * @var string
16
     */
17
    protected $apiUrl = "https://api.humanapi.co";
18
19
    /**
20
     * @var int
21
     */
22
    protected $apiVersion = 1;
23
24
25
    /**
26
     * @var string
27
     */
28
    protected $method = "get";
29
30
    /**
31
     * Build collection
32
     *
33
     * @param array $data
34
     * @return Collection
35
     */
36
    protected function buildCollection(array $data)
37
    {
38
        $collection = new Collection();
39
        foreach ($data as $row) {
40
            foreach (array("createdAt", "updatedAt", "timestamp", "startTime", "endTime") as $key) {
41
                if (array_key_exists($key, $row)) {
42
                    $row[$key] = new \DateTime($row[$key]);
43
                }
44
            }
45
            $model = new Model($row, $this);
46
            $collection->add($model);
47
        }
48
        return $collection;
49
    }
50
51
    /**
52
     * Build a url up from parts
53
     *
54
     * @param array $parts
55
     * @param string $api API
56
     * @return string
57
     */
58
    protected function buildUrlParts(array $parts, $api = "human")
59
    {
60
        $parts = array_merge(
61
            array(
62
                $this->apiUrl,
63
                "v" . $this->apiVersion,
64
                $api,
65
            ),
66
            $parts
67
        );
68
        return implode("/", $parts);
69
    }
70
}
71