Completed
Push — master ( 37a451...0fec48 )
by Artem
01:36
created

AbstractCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 53
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the FreshCentrifugoBundle.
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\CentrifugoBundle\Model;
14
15
/**
16
 * AbstractCentrifugoCommand.
17
 *
18
 * @author Artem Henvald <[email protected]>
19
 */
20
abstract class AbstractCommand implements SerializableCommandInterface
21
{
22
    private string $method;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
23
    private array $params;
24
25
    /**
26
     * @param string $method
27
     * @param array  $params
28
     */
29
    public function __construct(string $method, array $params)
30
    {
31
        $this->method = $method;
32
        $this->params = $params;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getMethod(): string
39
    {
40
        return $this->method;
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    public function getParams(): array
47
    {
48
        return $this->params;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function getChannels(): iterable
55
    {
56
        return [];
57
    }
58
59
    /**
60
     * @return array
61
     */
62
    public function jsonSerialize(): array
63
    {
64
        return [
65
            'method' => $this->method,
66
            'params' => $this->params,
67
        ];
68
    }
69
}
70