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.

Channel::read()   A
last analyzed

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
4
namespace Psonic\Channels;
5
use Psonic\Contracts\Client;
6
use Psonic\Contracts\Command;
7
use Psonic\Contracts\Response;
8
use Psonic\Commands\Misc\PingCommand;
9
use Psonic\Exceptions\ConnectionException;
10
use Psonic\Commands\Misc\QuitChannelCommand;
11
use Psonic\Contracts\Channel as ChannelInterface;
12
13
abstract class Channel implements ChannelInterface
14
{
15
    /**
16
     * @var Client
17
     */
18
    protected $client;
19
20
    /**
21
     * @var integer
22
     */
23
    protected $bufferSize;
24
25
    /**
26
     * Channel constructor.
27
     * @param Client $client
28
     */
29
    public function __construct(Client $client)
30
    {
31
        $this->client = $client;
32
    }
33
34
    /**
35
     * @return mixed|void
36
     * @throws ConnectionException
37
     */
38
    public function connect()
39
    {
40
        $this->client->connect();
41
        $response = $this->client->read();
42
        if($response->getStatus() == "CONNECTED") {
43
            return;
44
        }
45
        throw new ConnectionException;
46
    }
47
48
    /**
49
     * @return Response
50
     */
51
    public function disconnect(): Response
52
    {
53
        $message = $this->client->send(new QuitChannelCommand);
54
        $this->client->disconnect();
55
        return $message;
56
    }
57
58
    /**
59
     * @return Response
60
     */
61
    public function ping(): Response
62
    {
63
        return $this->client->send(new PingCommand);
64
    }
65
66
    /**
67
     * @return Response
68
     */
69
    public function read(): Response
70
    {
71
        return $this->client->read();
72
    }
73
74
    /**
75
     * @param Command $command
76
     * @return Response
77
     */
78
    public function send(Command $command): Response
79
    {
80
        return $this->client->send($command);
81
    }
82
}