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.
Completed
Pull Request — develop (#1)
by Gavin
02:42
created

Systems::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace JumpCloud\Operation;
4
5
use JumpCloud\Fields\FieldsInterface;
6
use JumpCloud\Fields\NoopFields;
7
use JumpCloud\Request\Request;
8
use JumpCloud\Request\RequestInterface;
9
use JumpCloud\Response\MultiformatResponseFactory;
10
11
/**
12
 * Class Authenticate
13
 * @package JumpCloud\Operation
14
 */
15
class Systems implements RequestInterface
16
{
17
    const ENDPOINT = 'https://console.jumpcloud.com/api/systems';
18
19
    use RequestOperationTrait;
20
21
    /**
22
     * @var FieldsInterface
23
     */
24
    private $fields;
25
26
    /**
27
     * Systems constructor.
28
     */
29
    public function __construct()
30
    {
31
        $request = new Request();
32
        $request->setUri(self::ENDPOINT);
33
        $request->setMethod('POST');
34
        $request->setResponseFactory(new MultiformatResponseFactory());
35
36
        $this->fields = new NoopFields();
37
38
        $this->request = $request;
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public function getBody()
45
    {
46
        $body = $this->request->getBody();
47
48
        if ($this->fields !== null) {
49
            $fields = $this->fields->getFields();
50
51
            if (is_array($fields)) {
52
                $fields = implode(' ', $fields);
53
            }
54
55
            $body[FieldsInterface::NAME] = $fields;
56
        }
57
58
        return $body;
59
    }
60
61
    /**
62
     * @param FieldsInterface $fields
63
     */
64
    public function setFields(FieldsInterface $fields)
65
    {
66
        $this->fields = $fields;
67
    }
68
}
69