WebSocketEvents   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 17
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A close() 0 3 1
A error() 0 3 1
A message() 0 5 1
1
<?php
2
3
namespace leocata\m1Bot\Events;
4
5
use leocata\M1\Api;
6
use leocata\m1Bot\Interfaces\EventInterface;
7
8
class WebSocketEvents implements EventInterface
9
{
10
    public function message($message, Api $apiWrapper, \GearmanClient $gearmanClient)
11
    {
12
        $method = $apiWrapper->getCallbackMethod($message);
13
        $methodName = lcfirst($method->getMethodName());
14
        $gearmanClient->doHighBackground($methodName, json_encode($method));
15
    }
16
17
    public function close($code, $reason)
18
    {
19
        echo "Connection closed. ({$code}){$reason}" . PHP_EOL;
20
    }
21
22
    public function error(\Exception $exception)
23
    {
24
        echo $exception->getMessage();
25
    }
26
}
27