ServiceConsoleTransport   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createFetcher() 0 3 1
A run() 0 3 1
A createSession() 0 3 1
1
<?php
2
namespace Mezon\Service\ServiceConsoleTransport;
3
4
use Mezon\Service\Transport;
5
use Mezon\Transport\RequestParamsInterface;
6
7
/**
8
 * Class ServiceConsoleTransport
9
 *
10
 * @package Service
11
 * @subpackage ServiceConsoleTransport
12
 * @author Dodonov A.A.
13
 * @version v.1.0 (2019/08/07)
14
 * @copyright Copyright (c) 2019, aeon.org
15
 */
16
17
/**
18
 * Console transport for all services
19
 */
20
class ServiceConsoleTransport extends Transport
21
{
22
23
    /**
24
     * Execution result
25
     * 
26
     * @var mixed
27
     */
28
    public static $result;
29
30
    /**
31
     * Method creates parameters fetcher
32
     *
33
     * @return RequestParamsInterface paremeters fetcher
34
     */
35
    public function createFetcher(): RequestParamsInterface
36
    {
37
        return new ConsoleRequestParams($this->getRouter());
38
    }
39
40
    /**
41
     * Method runs router
42
     */
43
    public function run(): void
44
    {
45
        static::$result = $this->getRouter()->callRoute($_GET['r']);
46
    }
47
48
    /**
49
     * Method creates session
50
     *
51
     * @param string $token
52
     *            session token
53
     */
54
    public function createSession(string $token): string
55
    {
56
        return $token;
57
    }
58
}
59