SubscribeTicker   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 32
ccs 9
cts 9
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPayload() 0 6 1
A __construct() 0 3 1
A getFrame() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Codenixsv\BitfinexWs\Request;
6
7
use Ratchet\RFC6455\Messaging\Frame;
8
9
/**
10
 * Class SubscribeTicker
11
 * @package Codenixsv\BitfinexWs\Request
12
 */
13
class SubscribeTicker implements Request
14
{
15
    /** @var string */
16
    private $symbol;
17
18
    /**
19
     * Ticker constructor.
20
     * @param string $symbol
21
     */
22 3
    public function __construct(string $symbol)
23
    {
24 3
        $this->symbol = $symbol;
25 3
    }
26
27
    /**
28
     * @return array
29
     */
30 3
    public function getPayload(): array
31
    {
32
        return [
33 3
            'event' => 'subscribe',
34 3
            'channel' => 'ticker',
35 3
            'symbol' => $this->symbol
36
        ];
37
    }
38
39
    /**
40
     * @return Frame
41
     */
42 2
    public function getFrame(): Frame
43
    {
44 2
        return new Frame(json_encode($this->getPayload()));
45
    }
46
}
47