1- <?php
2-
3- namespace Gitlab \HttpClient ;
1+ <?php namespace Gitlab \HttpClient ;
42
53use Buzz \Client \ClientInterface ;
64use Buzz \Listener \ListenerInterface ;
1513 * Performs requests on Gitlab API. API documentation should be self-explanatory.
1614 *
1715 * @author Joseph Bielawski <stloyd@gmail.com>
16+ * @author Matt Humphrey <matt@m4tt.co>
1817 */
1918class HttpClient implements HttpClientInterface
2019{
@@ -26,18 +25,28 @@ class HttpClient implements HttpClientInterface
2625 'timeout ' => 10 ,
2726 );
2827
29- protected $ base_url = null ;
28+ /**
29+ * @var string
30+ */
31+ protected $ baseUrl ;
3032
3133 /**
32- * @var array
34+ * @var ListenerInterface[]
3335 */
3436 protected $ listeners = array ();
3537 /**
3638 * @var array
3739 */
3840 protected $ headers = array ();
3941
42+ /**
43+ * @var Response
44+ */
4045 private $ lastResponse ;
46+
47+ /**
48+ * @var Request
49+ */
4150 private $ lastRequest ;
4251
4352 /**
@@ -46,9 +55,9 @@ class HttpClient implements HttpClientInterface
4655 */
4756 public function __construct ($ baseUrl , array $ options , ClientInterface $ client )
4857 {
49- $ this ->base_url = $ baseUrl ;
50- $ this ->options = array_merge ($ this ->options , $ options );
51- $ this ->client = $ client ;
58+ $ this ->baseUrl = $ baseUrl ;
59+ $ this ->options = array_merge ($ this ->options , $ options );
60+ $ this ->client = $ client ;
5261
5362 $ this ->addListener (new ErrorListener ($ this ->options ));
5463
@@ -136,7 +145,7 @@ public function put($path, array $parameters = array(), array $headers = array()
136145 */
137146 public function request ($ path , array $ parameters = array (), $ httpMethod = 'GET ' , array $ headers = array ())
138147 {
139- $ path = trim ($ this ->base_url .$ path , '/ ' );
148+ $ path = trim ($ this ->baseUrl .$ path , '/ ' );
140149
141150 $ request = $ this ->createRequest ($ httpMethod , $ path );
142151 $ request ->addHeaders ($ headers );
@@ -190,7 +199,6 @@ public function getLastResponse()
190199 /**
191200 * @param string $httpMethod
192201 * @param string $url
193- *
194202 * @return Request
195203 */
196204 private function createRequest ($ httpMethod , $ url )
0 commit comments