Completed
Push — master ( c4ac20...9f721d )
by Alex
03:45
created

ServiceConsoleTransport::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
namespace Mezon\Service\ServiceConsoleTransport;
3
4
/**
5
 * Class ServiceConsoleTransport
6
 *
7
 * @package Service
8
 * @subpackage ServiceConsoleTransport
9
 * @author Dodonov A.A.
10
 * @version v.1.0 (2019/08/07)
11
 * @copyright Copyright (c) 2019, aeon.org
12
 */
13
14
/**
15
 * Console transport for all services
16
 */
17
class ServiceConsoleTransport extends \Mezon\Service\ServiceTransport
18
{
19
20
    /**
21
     * Execution result
22
     */
23
    public $result;
24
25
    /**
26
     * Method creates parameters fetcher
27
     *
28
     * @return \Mezon\Service\ServiceRequestParamsInterface paremeters fetcher
29
     */
30
    public function createFetcher(): \Mezon\Service\ServiceRequestParamsInterface
31
    {
32
        return new \Mezon\Service\ServiceConsoleTransport\ConsoleRequestParams($this->getRouter());
0 ignored issues
show
Unused Code introduced by
The call to Mezon\Service\ServiceCon...stParams::__construct() has too many arguments starting with $this->getRouter(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        return /** @scrutinizer ignore-call */ new \Mezon\Service\ServiceConsoleTransport\ConsoleRequestParams($this->getRouter());

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
33
    }
34
35
    /**
36
     * Method runs router
37
     */
38
    public function run(): void
39
    {
40
        $this->result = $this->getRouter()->callRoute($_GET['r']);
41
    }
42
43
    /**
44
     * Method creates session
45
     *
46
     * @param bool|string $token
47
     *            Session token
48
     */
49
    public function createSession(string $token): string
50
    {
51
        return $token;
52
    }
53
}
54