2626 *
2727 * @author Glen Campbell <[email protected] > 2828 */
29- abstract class Service extends \OpenCloud \Base \Base
29+ abstract class Service extends \OpenCloud \Base \Base
3030{
3131
3232 private $ conn ;
3333 private $ service_type ;
3434 private $ service_name ;
35- private $ service_region ;
35+ private $ service_region ;
3636 private $ service_url ;
37-
37+
3838 protected $ _namespaces = array ();
3939
4040 /**
@@ -54,10 +54,10 @@ abstract class Service extends \OpenCloud\Base\Base
5454 * (e.g., "publicURL")
5555 */
5656 public function __construct (
57- OpenStack $ conn ,
58- $ type ,
59- $ name ,
60- $ region ,
57+ OpenStack $ conn ,
58+ $ type ,
59+ $ name ,
60+ $ region ,
6161 $ urltype = RAXSDK_URL_PUBLIC
6262 ) {
6363 $ this ->conn = $ conn ;
@@ -77,11 +77,11 @@ public function __construct(
7777 public function Url ($ resource = '' , array $ param = array ())
7878 {
7979 $ baseurl = $ this ->service_url ;
80-
80+
8181 if ($ resource ) {
8282 $ baseurl = Lang::noslash ($ baseurl ).'/ ' .$ resource ;
8383 }
84-
84+
8585 if (!empty ($ param )) {
8686 $ baseurl .= '? ' .$ this ->MakeQueryString ($ param );
8787 }
@@ -95,7 +95,7 @@ public function Url($resource = '', array $param = array())
9595 * @api
9696 * @return array of objects
9797 */
98- public function Extensions ()
98+ public function Extensions ()
9999 {
100100 $ ext = $ this ->GetMetaUrl ('extensions ' );
101101
@@ -112,10 +112,10 @@ public function Extensions()
112112 * @api
113113 * @return array of limits
114114 */
115- public function Limits ()
115+ public function Limits ()
116116 {
117117 $ lim = $ this ->GetMetaUrl ('limits ' );
118-
118+
119119 if (is_object ($ lim )) {
120120 return $ lim ->limits ;
121121 } else {
@@ -137,10 +137,14 @@ public function Limits()
137137 * @param string $body An optional body for POST/PUT requests
138138 * @return \OpenCloud\HttpResult
139139 */
140- public function Request ($ url , $ method = 'GET ' , array $ headers = array () ,$ body = null )
140+ public function Request (
141+ $ url ,
142+ $ method = 'GET ' ,
143+ array $ headers = array (),
144+ $ body = null )
141145 {
142146 $ headers ['X-Auth-Token ' ] = $ this ->conn ->Token ();
143-
147+
144148 if ($ tenant = $ this ->conn ->Tenant ()) {
145149 $ headers ['X-Auth-Project-Id ' ] = $ tenant ;
146150 }
@@ -158,7 +162,7 @@ public function Request($url, $method = 'GET', array $headers = array() ,$body =
158162 * query strings
159163 * @return \OpenCloud\Collection
160164 */
161- public function Collection ($ class , $ url = null , $ parent = null , array $ parm = array ())
165+ public function Collection ($ class , $ url = null , $ parent = null , array $ parm = array ())
162166 {
163167 // set the element name
164168 $ collection = $ class ::JsonCollectionName ();
@@ -229,7 +233,7 @@ public function Collection($class, $url = null, $parent = null, array $parm = ar
229233 } elseif (isset ($ obj ->$ collection )) {
230234 if (!$ element ) {
231235 $ coll_obj = new Collection ($ parent , $ class , $ obj ->$ collection );
232- } else {
236+ } else {
233237 // handle element levels
234238 $ arr = array ();
235239 foreach ($ obj ->$ collection as $ index => $ item ) {
@@ -256,7 +260,7 @@ public function Collection($class, $url = null, $parent = null, array $parm = ar
256260 * @api
257261 * @return string
258262 */
259- public function Region ()
263+ public function Region ()
260264 {
261265 return $ this ->service_region ;
262266 }
@@ -269,7 +273,7 @@ public function Region()
269273 * @api
270274 * @return string
271275 */
272- public function Name ()
276+ public function Name ()
273277 {
274278 return $ this ->service_name ;
275279 }
@@ -279,7 +283,7 @@ public function Name()
279283 *
280284 * @return array
281285 */
282- public function namespaces ()
286+ public function namespaces ()
283287 {
284288 if (!isset ($ this ->_namespaces )) {
285289 return array ();
@@ -308,7 +312,7 @@ public function namespaces()
308312 * @param string $urltype The URL type; defaults to "publicURL"
309313 * @return string The URL of the service
310314 */
311- private function get_endpoint ($ type , $ name , $ region , $ urltype = 'publicURL ' )
315+ private function get_endpoint ($ type , $ name , $ region , $ urltype = 'publicURL ' )
312316 {
313317 $ found = 0 ;
314318 $ catalog = $ this ->conn ->serviceCatalog ();
@@ -354,7 +358,7 @@ private function get_endpoint($type, $name, $region, $urltype = 'publicURL')
354358 * at the beginning or end
355359 * @return \stdClass object
356360 */
357- private function GetMetaUrl ($ resource )
361+ private function GetMetaUrl ($ resource )
358362 {
359363 $ urlbase = $ this ->get_endpoint (
360364 $ this ->service_type ,
@@ -380,15 +384,15 @@ private function GetMetaUrl($resource)
380384 if ($ response ->HttpStatus () >= 300 ) {
381385 throw new Exceptions \HttpError (sprintf (
382386 Lang::translate ('Error accessing [%s] - status [%d], response [%s] ' ),
383- $ urlbase ,
384- $ response ->HttpStatus (),
387+ $ urlbase ,
388+ $ response ->HttpStatus (),
385389 $ response ->HttpBody ()
386390 ));
387391 }
388392
389393 // we're good; proceed
390394 $ obj = json_decode ($ response ->HttpBody ());
391-
395+
392396 if ($ this ->CheckJsonError ()) {
393397 return false ;
394398 }
0 commit comments