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.
Test Setup Failed
Pull Request — master (#3)
by Sean
02:21
created

Curl::getInfo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Kobas\APIClient\Request;
4
5
6
/**
7
 * Class Curl
8
 * @package Kobas\APIClient\Request
9
 */
10
class Curl implements HttpRequest
11
{
12
    /**
13
     * @var null
14
     */
15
    private $handle = null;
16
17
    /**
18
     * @return $this
19
     */
20
    public function init()
21
    {
22
        if (is_null($this->handle)) {
23
            $this->handle = curl_init();
0 ignored issues
show
Documentation Bug introduced by
It seems like curl_init() of type resource is incompatible with the declared type null of property $handle.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
24
        }
25
26
        return $this;
27
    }
28
29
    /**
30
     * @param $url
31
     * @return $this|Curl
32
     */
33
    public function setUrl($url)
34
    {
35
        return $this->setOption(CURLOPT_URL, $url);
36
    }
37
38
    /**
39
     * @param $name
40
     * @param $value
41
     * @return $this
42
     */
43
    public function setOption($name, $value)
44
    {
45
        curl_setopt($this->handle, $name, $value);
46
        return $this;
47
    }
48
49
50
51
    /**
52
     * @return null
53
     */
54
    public function getHandle()
55
    {
56
        return $this->handle;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62
    public function execute()
63
    {
64
        return curl_exec($this->handle);
65
    }
66
67
    /**
68
     * @param $name
69
     * @return mixed
70
     */
71
    public function getInfo($name)
72
    {
73
        return curl_getinfo($this->handle, $name);
74
    }
75
76
    /**
77
     * @return int|mixed
78
     */
79
    public function getErrorNumber() {
80
        return curl_errno($this->handle);
81
    }
82
83
    /**
84
     * @return mixed|string
85
     */
86
    public function getErrorMessage() {
87
        return curl_error($this->handle);
88
    }
89
90
    /**
91
     * @return $this
92
     */
93
    public function close()
94
    {
95
        curl_close($this->handle);
96
        $this->handle = null;
97
98
        return $this;
99
    }
100
}