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.

SocketException::__construct()   B
last analyzed

Complexity

Conditions 4
Paths 5

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 4.25

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 22
ccs 6
cts 8
cp 0.75
rs 8.9197
cc 4
eloc 14
nc 5
nop 1
crap 4.25
1
<?php
2
3
namespace Navarr\Socket\Exception;
4
5
class SocketException extends \Exception
6
{
7
    protected $message = 'Socket Exception';
8
9 2
    /**
10
     * SocketException constructor.
11 2
     *
12 1
     * @param string|resource|null $message Provide a resource instead of a message to use the socket_last_error as the
13 1
     *                                      message
14 1
     */
15
    public function __construct($message = null)
16
    {
17
        if (!$message) {
18
            $errno = socket_last_error();
19
        } elseif (is_resource($message)) {
20
            $errno = socket_last_error($message);
21 2
        } else {
22
            parent::__construct((string) $message);
23 2
24
            return;
25 2
        }
26 1
27
        $error = socket_strerror($errno);
28 1
29
        parent::__construct($error, $errno);
30 2
31
        if (!$message) {
32
            socket_clear_error();
33
        } else {
34
            socket_clear_error($message);
35
        }
36
    }
37
}
38