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

GearmanWorker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A whoaMe() 0 5 1
1
<?php
2
3
namespace leocata\m1Bot\Workers;
4
5
use leocata\M1\Api;
6
use leocata\M1\Methods\Request\GetUserInfo;
7
8
class GearmanWorker {
9
10
    private $apiConn;
11
    private $worker;
12
13
    public function __construct($auth)
14
    {
15
        $this->apiConn = new Api($auth);
16
        $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...
17
        $this->worker->addServer();
18
        $this->worker->addFunction('Message', 'Message', $this->apiConn);
19
        $this->worker->addFunction('Typing', 'Typing', $this->apiConn);
20
        $this->worker->addFunction('State', 'State', $this->apiConn);
21
        $this->worker->addFunction('ContactRequested', 'ContactRequested', $this->apiConn);
22
    }
23
24
    public function whoaMe()
25
    {
26
        /** @var GetUserInfo $method */
27
        $method = $this->apiConn->sendApiRequest(new GetUserInfo());
28
        return $method->getUserId();
29
    }
30
}
31