Completed
Push — master ( baee16...d38af1 )
by Fabian
02:13
created

OHLCDataRequest::getRequestData()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 4
nop 0
dl 0
loc 11
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\RequestInterface;
7
8
/**
9
 * Class ServerTimeRequest
10
 *
11
 * @package HanischIt\KrakenApi\Model\ServerTime
12
 */
13
class OHLCDataRequest implements RequestInterface
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
     * OHLCDataRequest constructor.
33
     * @param string $pair
34
     * @param int $interval
35
     * @param int $since
36
     */
37
    public function __construct($pair, $interval, $since)
38
    {
39
        $this->pair = $pair;
40
        $this->interval = $interval;
41
        $this->since = $since;
42
    }
43
44
    /**
45
     * Returns the api request name
46
     *
47
     * @return string
48
     */
49
    public function getMethod()
50
    {
51
        return 'OHLC';
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getVisibility()
58
    {
59
        return VisibilityEnum::VISIBILITY_PUBLIC;
60
    }
61
62
    /**
63
     * @return array
64
     */
65
    public function getRequestData()
66
    {
67
        $ret = [];
68
        $ret["pair"] = $this->pair;
69
        if (null !== $this->interval) {
70
            $ret["interval"] = $this->interval;
71
        }
72
        if (null !== $this->since) {
73
            $ret["since"] = $this->since;
74
        }
75
        return $ret;
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getResponseClassName()
82
    {
83
        return OHLCDataResponse::class;
84
    }
85
}
86