Completed
Push — master ( 3ad417...37b5d9 )
by Fabian
02:10
created

OHLCDataAbstractRequest::getRequestData()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 4
nop 0
dl 0
loc 11
ccs 10
cts 10
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace HanischIt\KrakenApi\Model\OHLCData;
4
5
use HanischIt\KrakenApi\Enum\VisibilityEnum;
6
use HanischIt\KrakenApi\Model\AbstractRequest;
7
8
/**
9
 * Class ServerTimeAbstractRequest
10
 *
11
 * @package HanischIt\KrakenApi\Model\ServerTime
12
 */
13
class OHLCDataAbstractRequest extends AbstractRequest
14
{
15
16
    /**
17
     * @var string
18
     */
19
    private $pair;
20
21
    /**
22
     * @var int
23
     */
24
    private $interval;
25
26
    /**
27
     * @var int
28
     */
29
    private $since;
30
31
    /**
32
     * OHLCDataAbstractRequest constructor.
33
     * @param string $pair
34
     * @param int $interval
35
     * @param int $since
36
     */
37 2
    public function __construct($pair, $interval, $since)
38
    {
39 2
        $this->pair = $pair;
40 2
        $this->interval = $interval;
41 2
        $this->since = $since;
42 2
    }
43
44
    /**
45
     * Returns the api request name
46
     *
47
     * @return string
48
     */
49 1
    public function getMethod()
50
    {
51 1
        return 'OHLC';
52
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getVisibility()
58
    {
59 1
        return VisibilityEnum::VISIBILITY_PUBLIC;
60
    }
61
62
    /**
63
     * @return array
64
     */
65 1
    public function getRequestData()
66
    {
67 1
        $ret = [];
68 1
        $ret["pair"] = $this->pair;
69 1
        if (null !== $this->interval) {
70 1
            $ret["interval"] = $this->interval;
71 1
        }
72 1
        if (null !== $this->since) {
73 1
            $ret["since"] = $this->since;
74 1
        }
75 1
        return $ret;
76
    }
77
78
    /**
79
     * @return string
80
     */
81 1
    public function getResponseClassName()
82
    {
83 1
        return OHLCDataResponse::class;
84
    }
85
}
86