Code Duplication    Length = 61-65 lines in 6 locations

src/Model/OrderBook/OrderBookRequest.php 1 location

@@ 13-73 (lines=61) @@
10
 *
11
 * @package HanischIt\KrakenApi\Model\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/Model/RecentTrades/RecentTradesRequest.php 1 location

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

src/Model/SpreadData/SpreadDataRequest.php 1 location

@@ 13-73 (lines=61) @@
10
 *
11
 * @package HanischIt\KrakenApi\Model\SpreadData
12
 */
13
class SpreadDataRequest implements RequestInterface
14
{
15
    /**
16
     * @var
17
     */
18
    private $assetPair;
19
    /**
20
     * @var null
21
     */
22
    private $since;
23
24
    /**
25
     * OrderBookRequest constructor.
26
     * @param $assetPair
27
     * @param null|mixed $since
28
     */
29
    public function __construct($assetPair, $since = null)
30
    {
31
        $this->assetPair = $assetPair;
32
        $this->since = $since;
33
    }
34
35
    /**
36
     * Returns the api request name
37
     *
38
     * @return string
39
     */
40
    public function getMethod()
41
    {
42
        return 'Spread';
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->since) {
61
            $arr["since"] = $this->since;
62
        }
63
        return $arr;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getResponseClassName()
70
    {
71
        return SpreadDataResponse::class;
72
    }
73
}
74

src/Model/TradableAssetPairs/TradableAssetPairsRequest.php 1 location

@@ 12-73 (lines=62) @@
9
 * Class TradableAssetPairsRequest
10
 * @package HanischIt\KrakenApi\Model\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/Model/Trades/TradesRequest.php 1 location

@@ 12-72 (lines=61) @@
9
 * Class TradesRequest
10
 * @package HanischIt\KrakenApi\Model\Trades
11
 */
12
class TradesRequest implements RequestInterface
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $txid;
19
    /**
20
     * @var bool
21
     */
22
    private $trades = false;
23
24
    /**
25
     * TradesRequest constructor.
26
     * @param string $txid
27
     * @param bool $trades
28
     */
29
    public function __construct($txid, $trades = false)
30
    {
31
        $this->txid = $txid;
32
        $this->trades = $trades;
33
    }
34
35
36
    /**
37
     * Returns the api request name
38
     *
39
     * @return string
40
     */
41
    public function getMethod()
42
    {
43
        return 'QueryTrades';
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
        $ret["txid"] = $this->txid;
61
        $ret["trades"] = $this->trades;
62
        return $ret;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getResponseClassName()
69
    {
70
        return TradesResponse::class;
71
    }
72
}
73

src/Model/TradeVolume/TradeVolumeRequest.php 1 location

@@ 12-76 (lines=65) @@
9
 * Class TradeVolumeRequest
10
 * @package HanischIt\KrakenApi\Model\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