Passed
Pull Request — master (#10)
by Fabian
02:17
created

OHLCDataRequest::getVisibility()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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