Code Duplication    Length = 61-64 lines in 4 locations

src/Model/OrderBook/OrderBookAbstractRequest.php 1 location

@@ 13-73 (lines=61) @@
10
 *
11
 * @package HanischIt\KrakenApi\Model\OrderBook
12
 */
13
class OrderBookAbstractRequest extends AbstractRequest
14
{
15
    /**
16
     * @var
17
     */
18
    private $assetPair;
19
    /**
20
     * @var null
21
     */
22
    private $count;
23
24
    /**
25
     * OrderBookAbstractRequest constructor.
26
     * @param $assetPair
27
     * @param null $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/RecentTradesAbstractRequest.php 1 location

@@ 13-76 (lines=64) @@
10
 *
11
 * @package HanischIt\Model\RecentTrades
12
 */
13
class RecentTradesAbstractRequest extends AbstractRequest
14
{
15
    /**
16
     * @var string
17
     */
18
    private $assetPair;
19
    /**
20
     * @var string
21
     */
22
    private $since;
23
24
    /**
25
     * RecentTradesAbstractRequest 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/SpreadDataAbstractRequest.php 1 location

@@ 13-73 (lines=61) @@
10
 *
11
 * @package HanischIt\KrakenApi\Model\SpreadData
12
 */
13
class SpreadDataAbstractRequest extends AbstractRequest
14
{
15
    /**
16
     * @var
17
     */
18
    private $assetPair;
19
    /**
20
     * @var null
21
     */
22
    private $since;
23
24
    /**
25
     * OrderBookAbstractRequest 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/TradableAssetPairsAbstractRequest.php 1 location

@@ 12-73 (lines=62) @@
9
 * Class TradableAssetPairsAbstractRequest
10
 * @package HanischIt\KrakenApi\Model\TradableAssetPairs
11
 */
12
class TradableAssetPairsAbstractRequest extends AbstractRequest
13
{
14
    /**
15
     * @var string
16
     */
17
    private $info;
18
    /**
19
     * @var array
20
     */
21
    private $pair;
22
23
    /**
24
     * TradableAssetPairsAbstractRequest 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