@@ -19,19 +19,18 @@ class Client
1919 private $ headers = array ();
2020 private $ requestOptions = array ();
2121 private $ urlCache = array ();
22- private $ logger = null ; // FOR DEBUGGING PURPOSES
22+ private $ logger = null ;
2323
2424 public function __construct ($ username , $ password , $ customerId , $ baseUrl , $ acceptFormat = 'json ' )
2525 {
26- $ this ->_authenticate ($ username , $ password , $ customerId ); // maybe decouple base URL construction and auth??
26+ $ this ->_authenticate ($ username , $ password , $ customerId );
2727 $ this ->baseUrl = $ baseUrl . '/ ' . $ this ->customerId . '/ ' ;
2828 $ this ->setAcceptFormat ($ acceptFormat );
2929 $ this ->client = new Http (['base_uri ' => $ this ->baseUrl ]);
3030 // allowed HTTP methods
3131 $ this ->methods = [
3232 'get ' , 'post ' , 'put '
3333 ];
34- // DEBUG: set up logger
3534 $ logger = new Logger ('application_logger ' );
3635 $ logger ->pushHandler (new StreamHandler (__DIR__ .'/debug.log ' , Logger::DEBUG ));
3736 $ this ->logger = $ logger ;
@@ -92,7 +91,7 @@ public function __call($name, $args)
9291 }
9392 else
9493 {
95- throw new \Exception ("Method not allowed " ); // maybe change wording --> HTTP 401
94+ throw new \Exception ("Method not allowed " );
9695 }
9796 }
9897
@@ -123,7 +122,6 @@ public function makeRequest($method, $url, $requestBody = null)
123122 {
124123 if (null !== $ requestBody )
125124 {
126- // TODO: handle XML content type
127125 $ this ->requestOptions ['json ' ] = $ requestBody ;
128126 }
129127 return $ this ->client ->{$ method }($ url , $ this ->requestOptions );
0 commit comments