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   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 15
c 1
b 0
f 0
dl 0
loc 68
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A connect() 0 8 2
A read() 0 3 1
A send() 0 3 1
A __construct() 0 3 1
A ping() 0 3 1
A disconnect() 0 5 1
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
}