@@ -81,7 +81,7 @@ |
||
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
84 | - * @param array $option |
|
84 | + * @param array $options |
|
85 | 85 | * @return \Requests_Response |
86 | 86 | */ |
87 | 87 | public function get($path = '',$options = array()){ |
@@ -47,31 +47,31 @@ discard block |
||
47 | 47 | ); |
48 | 48 | public $requestOptions = array(); |
49 | 49 | |
50 | - public function __construct($firebaseURI,$firebaseSecret = '',$firebaseDefaultPath = '/') |
|
50 | + public function __construct($firebaseURI, $firebaseSecret = '', $firebaseDefaultPath = '/') |
|
51 | 51 | { |
52 | 52 | $this->firebaseSecret = $firebaseSecret; |
53 | 53 | $this->firebaseURI = $firebaseURI; |
54 | 54 | $this->firebaseDefaultPath = $firebaseDefaultPath; |
55 | 55 | } |
56 | 56 | |
57 | - public function getPathURI($path = ''){ |
|
57 | + public function getPathURI($path = '') { |
|
58 | 58 | //remove .json or last slash from firebaseURI |
59 | 59 | $templates = array( |
60 | 60 | '.json', |
61 | 61 | '/.json', |
62 | 62 | '/' |
63 | 63 | ); |
64 | - foreach ($templates as $template){ |
|
65 | - $this->firebaseURI = rtrim($this->firebaseURI,$template); |
|
64 | + foreach ($templates as $template) { |
|
65 | + $this->firebaseURI = rtrim($this->firebaseURI, $template); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | //check https |
69 | - if(strpos($this->firebaseURI, 'http://') !== false){ |
|
69 | + if (strpos($this->firebaseURI, 'http://') !== false) { |
|
70 | 70 | throw new \Exception("https is required."); |
71 | 71 | } |
72 | 72 | |
73 | 73 | //check firebaseURI |
74 | - if(strlen($this->firebaseURI) == 0){ |
|
74 | + if (strlen($this->firebaseURI) == 0) { |
|
75 | 75 | throw new \Exception("firebase URI is required"); |
76 | 76 | } |
77 | 77 | |
@@ -84,32 +84,32 @@ discard block |
||
84 | 84 | * @param array $option |
85 | 85 | * @return \Requests_Response |
86 | 86 | */ |
87 | - public function get($path = '',$options = array()){ |
|
88 | - if(isset($options['settings'])) { |
|
89 | - $requestOptions = array_merge($options['settings'],$this->requestOptions); |
|
87 | + public function get($path = '', $options = array()) { |
|
88 | + if (isset($options['settings'])) { |
|
89 | + $requestOptions = array_merge($options['settings'], $this->requestOptions); |
|
90 | 90 | } |
91 | - else{ |
|
91 | + else { |
|
92 | 92 | $requestOptions = $this->requestOptions; |
93 | 93 | } |
94 | 94 | |
95 | - return Requests::get($this->getPathURI($path),$this->requestHeader,$requestOptions); |
|
95 | + return Requests::get($this->getPathURI($path), $this->requestHeader, $requestOptions); |
|
96 | 96 | } |
97 | 97 | |
98 | - public function put($path = '',$options = array()){ |
|
99 | - $requestOptions = array_merge($options['data'],$this->requestOptions); |
|
100 | - return Requests::put($this->getPathURI($path),$this->requestHeader,json_encode($requestOptions)); |
|
98 | + public function put($path = '', $options = array()) { |
|
99 | + $requestOptions = array_merge($options['data'], $this->requestOptions); |
|
100 | + return Requests::put($this->getPathURI($path), $this->requestHeader, json_encode($requestOptions)); |
|
101 | 101 | } |
102 | 102 | |
103 | - public function post($path = '',$options = array()){ |
|
104 | - $requestOptions = array_merge($options['data'],$this->requestOptions); |
|
105 | - return Requests::post($this->getPathURI($path),$this->requestHeader,json_encode($requestOptions)); |
|
103 | + public function post($path = '', $options = array()) { |
|
104 | + $requestOptions = array_merge($options['data'], $this->requestOptions); |
|
105 | + return Requests::post($this->getPathURI($path), $this->requestHeader, json_encode($requestOptions)); |
|
106 | 106 | } |
107 | 107 | |
108 | - public function patch($path = '',$options = array()){ |
|
109 | - return Requests::patch($this->getPathURI($path),$this->requestHeader,$this->requestOptions); |
|
108 | + public function patch($path = '', $options = array()) { |
|
109 | + return Requests::patch($this->getPathURI($path), $this->requestHeader, $this->requestOptions); |
|
110 | 110 | } |
111 | 111 | |
112 | - public function delete($path = '',$options = array()){ |
|
113 | - return Requests::delete($this->getPathURI($path),$this->requestHeader,$this->requestOptions); |
|
112 | + public function delete($path = '', $options = array()) { |
|
113 | + return Requests::delete($this->getPathURI($path), $this->requestHeader, $this->requestOptions); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | \ No newline at end of file |
@@ -87,8 +87,7 @@ |
||
87 | 87 | public function get($path = '',$options = array()){ |
88 | 88 | if(isset($options['settings'])) { |
89 | 89 | $requestOptions = array_merge($options['settings'],$this->requestOptions); |
90 | - } |
|
91 | - else{ |
|
90 | + } else{ |
|
92 | 91 | $requestOptions = $this->requestOptions; |
93 | 92 | } |
94 | 93 |