@@ -32,20 +32,6 @@ abstract class AbstractAPI
32
32
*/
33
33
public $ connection ;
34
34
35
- /**
36
- * The requested offset.
37
- *
38
- * @var null|int
39
- */
40
- protected $ offset ;
41
-
42
- /**
43
- * Number of items per request.
44
- *
45
- * @var null|int
46
- */
47
- protected $ limit ;
48
-
49
35
/**
50
36
* Create a new API class instance.
51
37
*
@@ -56,53 +42,17 @@ public function __construct(Connection $connection)
56
42
$ this ->connection = $ connection ;
57
43
}
58
44
59
- public function getOffset (): ?int
60
- {
61
- return $ this ->offset ;
62
- }
63
-
64
- public function setOffset (int $ offset ): API
65
- {
66
- $ this ->offset = (null === $ offset ? $ offset : (int ) $ offset );
67
-
68
- return $ this ;
69
- }
70
-
71
- public function getLimit (): ?int
72
- {
73
- return $ this ->limit ;
74
- }
75
-
76
- public function setLimit (int $ limit ): API
77
- {
78
- $ this ->limit = (null === $ limit ? $ limit : (int ) $ limit );
79
-
80
- return $ this ;
81
- }
82
-
83
45
/**
84
46
* Send a GET request with query parameters.
85
47
*
86
48
* @param string $path
87
- * @param array $parameters
49
+ * @param array $query
88
50
*
89
51
* @return array|string
90
52
*/
91
- protected function get (string $ path , array $ parameters = [])
53
+ protected function get (string $ path , array $ query = [])
92
54
{
93
- if (null !== $ this ->offset && ! isset ($ parameters ['offset ' ])) {
94
- $ parameters ['offset ' ] = $ this ->offset ;
95
- }
96
-
97
- if (null !== $ this ->limit && ! isset ($ parameters ['limit ' ])) {
98
- $ parameters ['limit ' ] = $ this ->limit ;
99
- }
100
-
101
- if (count ($ parameters ) > 0 ) {
102
- $ path .= '? ' .http_build_query ($ parameters );
103
- }
104
-
105
- $ response = $ this ->connection ->getHttpClient ()->get ($ path );
55
+ $ response = $ this ->connection ->getHttpClient ()->get ($ path , compact ('query ' ));
106
56
107
57
return json_decode ($ response ->getBody ()->getContents (), true );
108
58
}
0 commit comments