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

WebSocketCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
A __construct() 0 3 1
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
}