SubscribeTicker::getPayload()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
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