WebSocketEvents::close()   A
last analyzed

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 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
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