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.
Passed
Push — master ( d1111f...994164 )
by Sean
01:06
created

Curl::getErrorMessage()   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 0
1
<?php
2
3
namespace Kobas\APIClient\Request;
4
5
/**
6
 * Class Curl
7
 *
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
     * @return null
52
     */
53
    public function getHandle()
54
    {
55
        return $this->handle;
56
    }
57
58
    /**
59
     * @return mixed
60
     */
61
    public function execute()
62
    {
63
        return curl_exec($this->handle);
64
    }
65
66
    /**
67
     * @param $name
68
     * @return mixed
69
     */
70
    public function getInfo($name)
71
    {
72
        return curl_getinfo($this->handle, $name);
73
    }
74
75
    /**
76
     * @return int|mixed
77
     */
78
    public function getErrorNumber()
79
    {
80
        return curl_errno($this->handle);
81
    }
82
83
    /**
84
     * @return mixed|string
85
     */
86
    public function getErrorMessage()
87
    {
88
        return curl_error($this->handle);
89
    }
90
91
    /**
92
     * @return $this
93
     */
94
    public function close()
95
    {
96
        curl_close($this->handle);
97
        $this->handle = null;
98
99
        return $this;
100
    }
101
}
102