Completed
Push — master ( 479a33...82b45c )
by Leo
01:42
created

MessageEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 55
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 1
A getMethod() 0 3 1
A run() 0 3 2
1
<?php
2
3
namespace leocata\m1Bot\Abstracts;
4
5
use leocata\M1\Api;
6
use leocata\m1Bot\Bot\BaseBot;
7
8
abstract class MessageEvent
9
{
10
11
    private $method;
12
    private $apiWrapper;
13
    private $worker;
14
    private $auth;
15
16
    /**
17
     * MessageEvent constructor.
18
     */
19
    final public function __construct()
20
    {
21
22
        $this->auth = (new BaseBot())->getAuth();
23
        $this->apiWrapper = new Api();
24
        $this->worker = new \GearmanWorker();
0 ignored issues
show
Bug introduced by
The type GearmanWorker was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
        $this->worker->addServer();
26
        $this->worker->addFunction('message', [$this, 'message']);
27
        $this->worker->addFunction('typing', [$this, 'typing']);
28
        $this->worker->addFunction('state', [$this, 'state']);
29
        $this->worker->addFunction('contactRequested', [$this, 'contactRequested']);
30
        $this->worker->addFunction('contactAccepted', [$this, 'contactAccepted']);
31
        $this->worker->addFunction('contactRejected', [$this, 'contactRejected']);
32
        $this->worker->addFunction('delivery', [$this, 'delivery']);
33
        $this->worker->addFunction('messageDeleted', [$this, 'messageDeleted']);
34
        $this->worker->addFunction('read', [$this, 'read']);
35
    }
36
37
    public function getMethod()
38
    {
39
        return $this->method;
40
    }
41
42
    abstract public function contactAccepted(\GearmanJob $job);
0 ignored issues
show
Bug introduced by
The type GearmanJob was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
43
44
    abstract public function contactRejected(\GearmanJob $job);
45
46
    abstract public function contactRequested(\GearmanJob $job);
47
48
    abstract public function delivery(\GearmanJob $job);
49
50
    abstract public function message(\GearmanJob $job);
51
52
    abstract public function messageDeleted(\GearmanJob $job);
53
54
    abstract public function read(\GearmanJob $job);
55
56
    abstract public function state(\GearmanJob $job);
57
58
    abstract public function typing(\GearmanJob $job);
59
60
    final public function run()
61
    {
62
        while ($this->worker->work()) {
63
            //Worker processing
64
        }
65
    }
66
}
67