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

Bot   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A runWebSocketWorker() 0 4 1
A setAuth() 0 3 1
1
<?php
2
3
namespace leocata\m1Bot;
4
5
use leocata\M1\HttpClientAuthorization;
6
use leocata\m1Bot\Workers\WebSocketWorker;
7
8
class Bot
9
{
10
    public $pass = '';
11
    public $username = '';
12
    private $auth;
13
14
    public function __construct()
15
    {
16
        $this->setAuth();
17
    }
18
19
    public function setAuth()
20
    {
21
        $this->auth = new HttpClientAuthorization($this->username, $this->pass);
22
    }
23
24
    protected function runWebSocketWorker($auth, $events)
25
    {
26
        $callbackWebSocket = new WebSocketWorker($auth, $events);
27
        return $callbackWebSocket->execute();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $callbackWebSocket->execute() targeting leocata\m1Bot\Workers\WebSocketWorker::execute() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
28
    }
29
}
30