Completed
Push — master ( 5eaa6c...e7a27d )
by Leo
01:29
created

WebSocketCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace leocata\m1Bot\Commands;
4
use GetOpt\Command;
5
use leocata\M1\HttpClientAuthorization;
6
use leocata\m1Bot\Events;
7
use leocata\m1Bot\Workers\WebSocketWorker;
8
9
class WebSocketCommand extends Command
10
{
11
    public $pass = '';
12
    public $username = '';
13
14
    public function __construct()
15
    {
16
        parent::__construct('websocket', [$this, 'handle']);
17
    }
18
19
    public function handle()
20
    {
21
        $auth = new HttpClientAuthorization($this->username, $this->pass);
22
        $socket = new WebSocketWorker($auth, new Events());
23
        $socket->execute();
24
    }
25
}