Code Duplication    Length = 61-65 lines in 3 locations

src/Call/OrderBook/OrderBookRequest.php 1 location

@@ 13-73 (lines=61) @@
10
 * Class OrderBookRequest
11
 * @package HanischIt\KrakenApi\Call\OrderBook
12
 */
13
class OrderBookRequest implements RequestInterface
14
{
15
    /**
16
     * @var
17
     */
18
    private $assetPair;
19
    /**
20
     * @var null
21
     */
22
    private $count;
23
24
    /**
25
     * OrderBookRequest constructor.
26
     * @param $assetPair
27
     * @param null|int $count
28
     */
29
    public function __construct($assetPair, $count = null)
30
    {
31
        $this->assetPair = $assetPair;
32
        $this->count = $count;
33
    }
34
35
    /**
36
     * Returns the api request name
37
     *
38
     * @return string
39
     */
40
    public function getMethod()
41
    {
42
        return 'Depth';
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getVisibility()
49
    {
50
        return VisibilityEnum::VISIBILITY_PUBLIC;
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    public function getRequestData()
57
    {
58
        $arr = [];
59
        $arr["pair"] = $this->assetPair;
60
        if ($this->count) {
61
            $arr["count"] = $this->count;
62
        }
63
        return $arr;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getResponseClassName()
70
    {
71
        return OrderBookResponse::class;
72
    }
73
}
74

src/Call/TradableAssetPairs/TradableAssetPairsRequest.php 1 location

@@ 12-73 (lines=62) @@
9
 * Class TradableAssetPairsRequest
10
 * @package HanischIt\KrakenApi\Call\TradableAssetPairs
11
 */
12
class TradableAssetPairsRequest implements RequestInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    private $info;
18
    /**
19
     * @var array
20
     */
21
    private $pair;
22
23
    /**
24
     * TradableAssetPairsRequest constructor.
25
     * @param string $info
26
     * @param string $pair
27
     */
28
    public function __construct($info = 'info', $pair = null)
29
    {
30
        $this->info = $info;
31
        $this->pair = $pair;
32
    }
33
34
35
    /**
36
     * Returns the api request name
37
     *
38
     * @return string
39
     */
40
    public function getMethod()
41
    {
42
        return 'AssetPairs';
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getVisibility()
49
    {
50
        return VisibilityEnum::VISIBILITY_PUBLIC;
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    public function getRequestData()
57
    {
58
        $arr = [];
59
        $arr["info"] = $this->info;
60
        if (null !== $this->pair) {
61
            $arr["pair"] = $this->pair;
62
        }
63
        return $arr;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getResponseClassName()
70
    {
71
        return TradableAssetPairsResponse::class;
72
    }
73
}
74

src/Call/TradeVolume/TradeVolumeRequest.php 1 location

@@ 12-76 (lines=65) @@
9
 * Class TradeVolumeRequest
10
 * @package HanischIt\KrakenApi\Call\TradeVolume
11
 */
12
class TradeVolumeRequest implements RequestInterface
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $pair;
19
    /**
20
     * @var bool
21
     */
22
    private $feeInfo;
23
24
    /**
25
     * TradeVolumeRequest constructor.
26
     * @param string $pair
27
     * @param bool $feeInfo
28
     */
29
    public function __construct($pair = null, $feeInfo = null)
30
    {
31
        $this->pair = $pair;
32
        $this->feeInfo = $feeInfo;
33
    }
34
35
36
    /**
37
     * Returns the api request name
38
     *
39
     * @return string
40
     */
41
    public function getMethod()
42
    {
43
        return 'TradeVolume';
44
    }
45
46
    /**
47
     * @return string
48
     */
49
    public function getVisibility()
50
    {
51
        return VisibilityEnum::VISIBILITY_PRIVATE;
52
    }
53
54
    /**
55
     * @return array
56
     */
57
    public function getRequestData()
58
    {
59
        $ret = [];
60
        if ($this->pair) {
61
            $ret["pair"] = $this->pair;
62
        }
63
        if ($this->feeInfo) {
64
            $ret["fee-info"] = $this->feeInfo;
65
        }
66
        return $ret;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getResponseClassName()
73
    {
74
        return TradeVolumeResponse::class;
75
    }
76
}
77