@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param array $attributes array og attributes that service expects |
261 | 261 | * @param array $parameters array of parameters that service expects |
262 | 262 | * |
263 | - * @return Object $this |
|
263 | + * @return Service $this |
|
264 | 264 | */ |
265 | 265 | final public function expects($method, $attributes, $parameters=array()) { |
266 | 266 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param array $attributes array og attributes that service likes |
281 | 281 | * @param array $parameters array of parameters that service likes |
282 | 282 | * |
283 | - * @return Object $this |
|
283 | + * @return Service $this |
|
284 | 284 | */ |
285 | 285 | final public function likes($method, $attributes, $parameters=array()) { |
286 | 286 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @param string $methods HTTP methods, comma separated |
308 | 308 | * |
309 | - * @return Object $this |
|
309 | + * @return Service $this |
|
310 | 310 | */ |
311 | 311 | final public function setSupportedMethods($methods) { |
312 | 312 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * Set service content type |
332 | 332 | * |
333 | 333 | * @param string $type Content Type |
334 | - * @return Object $this |
|
334 | + * @return Service $this |
|
335 | 335 | */ |
336 | 336 | final public function setContentType($type) { |
337 | 337 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @param string $charset Charset |
359 | 359 | * |
360 | - * @return Object $this |
|
360 | + * @return Service $this |
|
361 | 361 | */ |
362 | 362 | final public function setCharset($charset) { |
363 | 363 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | * Set success status code |
383 | 383 | * |
384 | 384 | * @param integer $code HTTP status code (in case of success) |
385 | - * @return Object $this |
|
385 | + * @return Service $this |
|
386 | 386 | */ |
387 | 387 | final public function setStatusCode($code) { |
388 | 388 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * @param string $header Header name |
434 | 434 | * @param string $value Header content (optional) |
435 | 435 | * |
436 | - * @return Object $this |
|
436 | + * @return Service $this |
|
437 | 437 | */ |
438 | 438 | final public function setHeader($header, $value=null) { |
439 | 439 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * |
485 | 485 | * @param array $headers Headers array |
486 | 486 | * |
487 | - * @return Object $this |
|
487 | + * @return Service $this |
|
488 | 488 | */ |
489 | 489 | final public function setHeaders($headers) { |
490 | 490 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | /** |
498 | 498 | * Unset headers |
499 | 499 | * |
500 | - * @return Object $this |
|
500 | + * @return Service $this |
|
501 | 501 | */ |
502 | 502 | final public function unsetHeaders() { |
503 | 503 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | /** |
522 | 522 | * Get service-supported HTTP methods |
523 | 523 | * |
524 | - * @return array Headers array |
|
524 | + * @return string Headers array |
|
525 | 525 | */ |
526 | 526 | final public function getSupportedMethods() { |
527 | 527 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * Return the callable class method that reflect the requested one |
557 | 557 | * |
558 | - * @return array Headers array |
|
558 | + * @return string Headers array |
|
559 | 559 | */ |
560 | 560 | final public function getCallableMethod($method) { |
561 | 561 |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @var array |
155 | 155 | */ |
156 | - private $supported_success_codes = array(200,202,204); |
|
156 | + private $supported_success_codes = array(200, 202, 204); |
|
157 | 157 | |
158 | 158 | /*************** HTTP METHODS IMPLEMENTATIONS **************/ |
159 | 159 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return Object $this |
250 | 250 | */ |
251 | - final public function expects($method, $attributes, $parameters=array()) { |
|
251 | + final public function expects($method, $attributes, $parameters = array()) { |
|
252 | 252 | |
253 | 253 | $method = strtoupper($method); |
254 | 254 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return Object $this |
270 | 270 | */ |
271 | - final public function likes($method, $attributes, $parameters=array()) { |
|
271 | + final public function likes($method, $attributes, $parameters = array()) { |
|
272 | 272 | |
273 | 273 | $method = strtoupper($method); |
274 | 274 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return Object $this |
423 | 423 | */ |
424 | - final public function setHeader($header, $value=null) { |
|
424 | + final public function setHeader($header, $value = null) { |
|
425 | 425 | |
426 | 426 | $this->headers[$header] = $value; |
427 | 427 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | */ |
439 | 439 | final public function unsetHeader($header) { |
440 | 440 | |
441 | - if ( isset($this->headers[$header]) ) { |
|
441 | + if (isset($this->headers[$header])) { |
|
442 | 442 | |
443 | 443 | unset($this->headers[$header]); |
444 | 444 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | */ |
460 | 460 | final public function getHeader($header) { |
461 | 461 | |
462 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
462 | + if (isset($this->headers[$header])) return $this->headers[$header]; |
|
463 | 463 | |
464 | 464 | return null; |
465 | 465 | |
@@ -522,15 +522,15 @@ discard block |
||
522 | 522 | */ |
523 | 523 | final public function getImplementedMethods() { |
524 | 524 | |
525 | - if ( method_exists($this, 'any') ) return explode(",",$this->supported_http_methods); |
|
525 | + if (method_exists($this, 'any')) return explode(",", $this->supported_http_methods); |
|
526 | 526 | |
527 | - $supported_methods = explode(',',$this->supported_http_methods); |
|
527 | + $supported_methods = explode(',', $this->supported_http_methods); |
|
528 | 528 | |
529 | 529 | $implemented_methods = array(); |
530 | 530 | |
531 | - foreach ( $supported_methods as $method ) { |
|
531 | + foreach ($supported_methods as $method) { |
|
532 | 532 | |
533 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
533 | + if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method); |
|
534 | 534 | |
535 | 535 | } |
536 | 536 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | */ |
546 | 546 | final public function getCallableMethod($method) { |
547 | 547 | |
548 | - if ( method_exists($this, strtolower($method)) ) return strtolower($method); |
|
548 | + if (method_exists($this, strtolower($method))) return strtolower($method); |
|
549 | 549 | |
550 | 550 | else return "any"; |
551 | 551 | |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | |
563 | 563 | return array( |
564 | 564 | |
565 | - ( sizeof($this->expected_attributes[$method]) == 0 AND sizeof($this->expected_attributes["ANY"]) != 0 ) ? $this->expected_attributes["ANY"] : $this->expected_attributes[$method], |
|
565 | + (sizeof($this->expected_attributes[$method]) == 0 AND sizeof($this->expected_attributes["ANY"]) != 0) ? $this->expected_attributes["ANY"] : $this->expected_attributes[$method], |
|
566 | 566 | |
567 | - ( sizeof($this->expected_parameters[$method]) == 0 AND sizeof($this->expected_parameters["ANY"]) != 0 ) ? $this->expected_parameters["ANY"] : $this->expected_parameters[$method] |
|
567 | + (sizeof($this->expected_parameters[$method]) == 0 AND sizeof($this->expected_parameters["ANY"]) != 0) ? $this->expected_parameters["ANY"] : $this->expected_parameters[$method] |
|
568 | 568 | |
569 | 569 | ); |
570 | 570 | |
@@ -581,9 +581,9 @@ discard block |
||
581 | 581 | |
582 | 582 | return array( |
583 | 583 | |
584 | - ( sizeof($this->liked_attributes[$method]) == 0 AND sizeof($this->liked_attributes["ANY"]) != 0 ) ? $this->liked_attributes["ANY"] : $this->liked_attributes[$method], |
|
584 | + (sizeof($this->liked_attributes[$method]) == 0 AND sizeof($this->liked_attributes["ANY"]) != 0) ? $this->liked_attributes["ANY"] : $this->liked_attributes[$method], |
|
585 | 585 | |
586 | - ( sizeof($this->liked_parameters[$method]) == 0 AND sizeof($this->liked_parameters["ANY"]) != 0 ) ? $this->liked_parameters["ANY"] : $this->liked_parameters[$method] |
|
586 | + (sizeof($this->liked_parameters[$method]) == 0 AND sizeof($this->liked_parameters["ANY"]) != 0) ? $this->liked_parameters["ANY"] : $this->liked_parameters[$method] |
|
587 | 587 | |
588 | 588 | ); |
589 | 589 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | final public function getAttribute($attribute) { |
621 | 621 | |
622 | - if ( isset($this->attributes[$attribute]) ) return $this->attributes[$attribute]; |
|
622 | + if (isset($this->attributes[$attribute])) return $this->attributes[$attribute]; |
|
623 | 623 | |
624 | 624 | return null; |
625 | 625 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * |
651 | 651 | * @return array |
652 | 652 | */ |
653 | - final public function getParameters($raw=false) { |
|
653 | + final public function getParameters($raw = false) { |
|
654 | 654 | |
655 | 655 | return $raw ? $this->raw_parameters : $this->parameters; |
656 | 656 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | */ |
666 | 666 | final public function getParameter($parameter) { |
667 | 667 | |
668 | - if ( isset($this->parameters[$parameter]) ) return $this->parameters[$parameter]; |
|
668 | + if (isset($this->parameters[$parameter])) return $this->parameters[$parameter]; |
|
669 | 669 | |
670 | 670 | return null; |
671 | 671 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | */ |
691 | 691 | final public function getRequestHeader($header) { |
692 | 692 | |
693 | - if ( isset($this->request_headers[$header]) ) return $this->request_headers[$header]; |
|
693 | + if (isset($this->request_headers[$header])) return $this->request_headers[$header]; |
|
694 | 694 | |
695 | 695 | return null; |
696 | 696 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | |
709 | 709 | private function methodsToArray() { |
710 | 710 | |
711 | - $methods = explode(",",$this->supported_http_methods); |
|
711 | + $methods = explode(",", $this->supported_http_methods); |
|
712 | 712 | |
713 | 713 | $methods_array = array(); |
714 | 714 |
@@ -459,7 +459,9 @@ discard block |
||
459 | 459 | */ |
460 | 460 | final public function getHeader($header) { |
461 | 461 | |
462 | - if ( isset($this->headers[$header]) ) return $this->headers[$header]; |
|
462 | + if ( isset($this->headers[$header]) ) { |
|
463 | + return $this->headers[$header]; |
|
464 | + } |
|
463 | 465 | |
464 | 466 | return null; |
465 | 467 | |
@@ -522,7 +524,9 @@ discard block |
||
522 | 524 | */ |
523 | 525 | final public function getImplementedMethods() { |
524 | 526 | |
525 | - if ( method_exists($this, 'any') ) return explode(",",$this->supported_http_methods); |
|
527 | + if ( method_exists($this, 'any') ) { |
|
528 | + return explode(",",$this->supported_http_methods); |
|
529 | + } |
|
526 | 530 | |
527 | 531 | $supported_methods = explode(',',$this->supported_http_methods); |
528 | 532 | |
@@ -530,7 +534,9 @@ discard block |
||
530 | 534 | |
531 | 535 | foreach ( $supported_methods as $method ) { |
532 | 536 | |
533 | - if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method); |
|
537 | + if ( method_exists($this, strtolower($method)) ) { |
|
538 | + array_push($implemented_methods,$method); |
|
539 | + } |
|
534 | 540 | |
535 | 541 | } |
536 | 542 | |
@@ -545,9 +551,11 @@ discard block |
||
545 | 551 | */ |
546 | 552 | final public function getCallableMethod($method) { |
547 | 553 | |
548 | - if ( method_exists($this, strtolower($method)) ) return strtolower($method); |
|
549 | - |
|
550 | - else return "any"; |
|
554 | + if ( method_exists($this, strtolower($method)) ) { |
|
555 | + return strtolower($method); |
|
556 | + } else { |
|
557 | + return "any"; |
|
558 | + } |
|
551 | 559 | |
552 | 560 | } |
553 | 561 | |
@@ -619,7 +627,9 @@ discard block |
||
619 | 627 | */ |
620 | 628 | final public function getAttribute($attribute) { |
621 | 629 | |
622 | - if ( isset($this->attributes[$attribute]) ) return $this->attributes[$attribute]; |
|
630 | + if ( isset($this->attributes[$attribute]) ) { |
|
631 | + return $this->attributes[$attribute]; |
|
632 | + } |
|
623 | 633 | |
624 | 634 | return null; |
625 | 635 | |
@@ -665,7 +675,9 @@ discard block |
||
665 | 675 | */ |
666 | 676 | final public function getParameter($parameter) { |
667 | 677 | |
668 | - if ( isset($this->parameters[$parameter]) ) return $this->parameters[$parameter]; |
|
678 | + if ( isset($this->parameters[$parameter]) ) { |
|
679 | + return $this->parameters[$parameter]; |
|
680 | + } |
|
669 | 681 | |
670 | 682 | return null; |
671 | 683 | |
@@ -690,7 +702,9 @@ discard block |
||
690 | 702 | */ |
691 | 703 | final public function getRequestHeader($header) { |
692 | 704 | |
693 | - if ( isset($this->request_headers[$header]) ) return $this->request_headers[$header]; |
|
705 | + if ( isset($this->request_headers[$header]) ) { |
|
706 | + return $this->request_headers[$header]; |
|
707 | + } |
|
694 | 708 | |
695 | 709 | return null; |
696 | 710 | |
@@ -712,7 +726,9 @@ discard block |
||
712 | 726 | |
713 | 727 | $methods_array = array(); |
714 | 728 | |
715 | - foreach ($methods as $method) $methods_array[$method] = array(); |
|
729 | + foreach ($methods as $method) { |
|
730 | + $methods_array[$method] = array(); |
|
731 | + } |
|
716 | 732 | |
717 | 733 | $methods_array['ANY'] = array(); |
718 | 734 |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | final public function get($header = null) { |
30 | 30 | |
31 | - if ( is_null($header) ) return $this->headers; |
|
31 | + if (is_null($header)) return $this->headers; |
|
32 | 32 | |
33 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
33 | + else if (array_key_exists($header, $this->headers)) return $this->headers[$header]; |
|
34 | 34 | |
35 | 35 | else return null; |
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - final public function set($header, $value=null) { |
|
39 | + final public function set($header, $value = null) { |
|
40 | 40 | |
41 | - if ( is_null($value) ) { |
|
41 | + if (is_null($value)) { |
|
42 | 42 | |
43 | 43 | $header = explode(":", $header); |
44 | 44 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | final public function unset($header = null) { |
58 | 58 | |
59 | - if ( is_null($header) ) { |
|
59 | + if (is_null($header)) { |
|
60 | 60 | |
61 | 61 | $this->headers = array(); |
62 | 62 | |
63 | 63 | return true; |
64 | 64 | |
65 | - } else if ( array_key_exists($header, $this->headers) ) { |
|
65 | + } else if (array_key_exists($header, $this->headers)) { |
|
66 | 66 | |
67 | 67 | unset($this->headers[$header]); |
68 | 68 |
@@ -28,11 +28,13 @@ |
||
28 | 28 | |
29 | 29 | final public function get($header = null) { |
30 | 30 | |
31 | - if ( is_null($header) ) return $this->headers; |
|
32 | - |
|
33 | - else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header]; |
|
34 | - |
|
35 | - else return null; |
|
31 | + if ( is_null($header) ) { |
|
32 | + return $this->headers; |
|
33 | + } else if ( array_key_exists($header, $this->headers) ) { |
|
34 | + return $this->headers[$header]; |
|
35 | + } else { |
|
36 | + return null; |
|
37 | + } |
|
36 | 38 | |
37 | 39 | } |
38 | 40 |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | |
27 | 27 | protected $parameters = array(); |
28 | 28 | |
29 | - final public function get($parameter=null) { |
|
29 | + final public function get($parameter = null) { |
|
30 | 30 | |
31 | - if ( is_null($parameter) ) return $this->parameters; |
|
31 | + if (is_null($parameter)) return $this->parameters; |
|
32 | 32 | |
33 | - else if ( array_key_exists($parameter, $this->parameters) ) { |
|
33 | + else if (array_key_exists($parameter, $this->parameters)) { |
|
34 | 34 | |
35 | 35 | return $this->parameters[$parameter]; |
36 | 36 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | final public function unset($parameter = null) { |
52 | 52 | |
53 | - if ( is_null($parameter) ) { |
|
53 | + if (is_null($parameter)) { |
|
54 | 54 | |
55 | 55 | $this->parameters = array(); |
56 | 56 | |
57 | 57 | return true; |
58 | 58 | |
59 | - } else if ( array_key_exists($parameter, $this->parameters) ) { |
|
59 | + } else if (array_key_exists($parameter, $this->parameters)) { |
|
60 | 60 | |
61 | 61 | unset($this->parameters[$parameter]); |
62 | 62 |
@@ -28,16 +28,16 @@ |
||
28 | 28 | |
29 | 29 | final public function get($parameter=null) { |
30 | 30 | |
31 | - if ( is_null($parameter) ) return $this->parameters; |
|
32 | - |
|
33 | - else if ( array_key_exists($parameter, $this->parameters) ) { |
|
31 | + if ( is_null($parameter) ) { |
|
32 | + return $this->parameters; |
|
33 | + } else if ( array_key_exists($parameter, $this->parameters) ) { |
|
34 | 34 | |
35 | 35 | return $this->parameters[$parameter]; |
36 | 36 | |
37 | + } else { |
|
38 | + return null; |
|
37 | 39 | } |
38 | 40 | |
39 | - else return null; |
|
40 | - |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | final public function set($parameter, $value) { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | header($_SERVER["SERVER_PROTOCOL"].' 204 No Content'); |
110 | 110 | header('Status: 204 No Content'); |
111 | - header('Content-Length: 0',true); |
|
111 | + header('Content-Length: 0', true); |
|
112 | 112 | |
113 | 113 | $return = null; |
114 | 114 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | case 303: //See Other |
121 | 121 | case 307: //Temporary Redirect |
122 | 122 | |
123 | - header("Location: ".$location->get(),true,$status); |
|
123 | + header("Location: ".$location->get(), true, $status); |
|
124 | 124 | |
125 | 125 | break; |
126 | 126 | |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | |
129 | 129 | $last_modified = $headers->get('Last-Modified'); |
130 | 130 | |
131 | - if ( is_null($last_modified) ) { |
|
131 | + if (is_null($last_modified)) { |
|
132 | 132 | |
133 | 133 | header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified'); |
134 | 134 | |
135 | - } else if ( is_int($last_modified) ) { |
|
135 | + } else if (is_int($last_modified)) { |
|
136 | 136 | |
137 | 137 | header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304); |
138 | 138 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | case 405: //Not allowed |
172 | 172 | |
173 | - header('Allow: ' . $value, true, 405); |
|
173 | + header('Allow: '.$value, true, 405); |
|
174 | 174 | |
175 | 175 | break; |
176 | 176 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | case 501: //Not implemented |
185 | 185 | |
186 | - header('Allow: ' . $value, true, 501); |
|
186 | + header('Allow: '.$value, true, 501); |
|
187 | 187 | |
188 | 188 | break; |
189 | 189 |
@@ -41,13 +41,13 @@ |
||
41 | 41 | */ |
42 | 42 | private static function getHeaders() { |
43 | 43 | |
44 | - if ( function_exists('getallheaders') ) return getallheaders(); |
|
44 | + if (function_exists('getallheaders')) return getallheaders(); |
|
45 | 45 | |
46 | 46 | $headers = array(); |
47 | 47 | |
48 | - foreach ( $_SERVER as $name => $value ) { |
|
48 | + foreach ($_SERVER as $name => $value) { |
|
49 | 49 | |
50 | - if ( substr($name, 0, 5) == 'HTTP_' ) { |
|
50 | + if (substr($name, 0, 5) == 'HTTP_') { |
|
51 | 51 | |
52 | 52 | $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; |
53 | 53 |
@@ -41,7 +41,9 @@ |
||
41 | 41 | */ |
42 | 42 | private static function getHeaders() { |
43 | 43 | |
44 | - if ( function_exists('getallheaders') ) return getallheaders(); |
|
44 | + if ( function_exists('getallheaders') ) { |
|
45 | + return getallheaders(); |
|
46 | + } |
|
45 | 47 | |
46 | 48 | $headers = array(); |
47 | 49 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | private static function getParameters() { |
48 | 48 | |
49 | - switch( $_SERVER['REQUEST_METHOD'] ) { |
|
49 | + switch ($_SERVER['REQUEST_METHOD']) { |
|
50 | 50 | |
51 | 51 | case 'POST': |
52 | 52 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function set($content) { |
42 | 42 | |
43 | - if ( !is_scalar($content) ) { |
|
43 | + if (!is_scalar($content)) { |
|
44 | 44 | |
45 | 45 | throw new Exception("Invalid HTTP content"); |
46 | 46 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function type($type = null) { |
56 | 56 | |
57 | - if ( is_null($type) ) { |
|
57 | + if (is_null($type)) { |
|
58 | 58 | |
59 | 59 | return $this->type; |
60 | 60 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function charset($charset = null) { |
70 | 70 | |
71 | - if ( is_null($charset) ) { |
|
71 | + if (is_null($charset)) { |
|
72 | 72 | |
73 | 73 | return $this->charset; |
74 | 74 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | public function set($code) { |
87 | 87 | |
88 | - if ( !array_key_exists($code, $this->http_status_codes) ) { |
|
88 | + if (!array_key_exists($code, $this->http_status_codes)) { |
|
89 | 89 | |
90 | 90 | throw new Exception("Invalid HTTP Status Code"); |
91 | 91 | |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - public function description($code=null) { |
|
100 | + public function description($code = null) { |
|
101 | 101 | |
102 | - if ( is_null($code) || !array_key_exists($code, $this->http_status_codes) ) { |
|
102 | + if (is_null($code) || !array_key_exists($code, $this->http_status_codes)) { |
|
103 | 103 | |
104 | 104 | $message = $this->http_status_codes[$this->status_code]; |
105 | 105 |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | "query" => array() |
47 | 47 | ); |
48 | 48 | |
49 | - if (count($folders) > 1 && empty($folders[0])) |
|
50 | - array_shift($folders); |
|
49 | + if (count($folders) > 1 && empty($folders[0])) { |
|
50 | + array_shift($folders); |
|
51 | + } |
|
51 | 52 | |
52 | 53 | if (count($folders) == 1 && empty($folders[0])) { |
53 | 54 | $this->def_route = $value; |
@@ -67,7 +68,9 @@ discard block |
||
67 | 68 | |
68 | 69 | $regex = $this->readpath($folders); |
69 | 70 | |
70 | - if (isset($this->routes[$regex])) unset($this->routes[$regex]); |
|
71 | + if (isset($this->routes[$regex])) { |
|
72 | + unset($this->routes[$regex]); |
|
73 | + } |
|
71 | 74 | |
72 | 75 | } |
73 | 76 |
@@ -124,14 +124,14 @@ |
||
124 | 124 | $value = preg_replace('/(?<!\\)\((?!\?)/', '(?:', $value); |
125 | 125 | $value = preg_replace('/\.([\*\+])(?!\?)/', '.\${1}?', $value); |
126 | 126 | |
127 | - $param_regex .= '(?P<' . $key . '>' . $value . ')' . (($field_required)?'{1}':'?'); |
|
127 | + $param_regex .= '(?P<'.$key.'>'.$value.')'.(($field_required) ? '{1}' : '?'); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | 131 | $this->readpath( |
132 | 132 | $folders, |
133 | 133 | $value, |
134 | - $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?') |
|
134 | + $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?') |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | } else { |