@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http; |
| 26 | 26 | |
| 27 | -class Headers extends \ArrayObject |
|
| 28 | -{ |
|
| 27 | +class Headers extends \ArrayObject { |
|
| 29 | 28 | } |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http; |
| 26 | 26 | |
| 27 | -class Response implements ResponseInterface |
|
| 28 | -{ |
|
| 27 | +class Response implements ResponseInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @var RequestInterface |
| 31 | 30 | */ |
@@ -54,40 +53,35 @@ discard block |
||
| 54 | 53 | /** |
| 55 | 54 | * @return RequestInterface |
| 56 | 55 | */ |
| 57 | - public function getRequest() |
|
| 58 | - { |
|
| 56 | + public function getRequest() { |
|
| 59 | 57 | return $this->request; |
| 60 | 58 | } |
| 61 | 59 | |
| 62 | 60 | /** |
| 63 | 61 | * @param RequestInterface $request |
| 64 | 62 | */ |
| 65 | - public function setRequest(RequestInterface $request) |
|
| 66 | - { |
|
| 63 | + public function setRequest(RequestInterface $request) { |
|
| 67 | 64 | $this->request = $request; |
| 68 | 65 | } |
| 69 | 66 | |
| 70 | 67 | /** |
| 71 | 68 | * @return int |
| 72 | 69 | */ |
| 73 | - public function getStatusCode() |
|
| 74 | - { |
|
| 70 | + public function getStatusCode() { |
|
| 75 | 71 | return $this->statusCode; |
| 76 | 72 | } |
| 77 | 73 | |
| 78 | 74 | /** |
| 79 | 75 | * @param int $status_code |
| 80 | 76 | */ |
| 81 | - public function setStatusCode($status_code) |
|
| 82 | - { |
|
| 77 | + public function setStatusCode($status_code) { |
|
| 83 | 78 | $this->statusCode = $status_code; |
| 84 | 79 | } |
| 85 | 80 | |
| 86 | 81 | /** |
| 87 | 82 | * @return Headers |
| 88 | 83 | */ |
| 89 | - public function getHeaders() |
|
| 90 | - { |
|
| 84 | + public function getHeaders() { |
|
| 91 | 85 | if ($this->headers === null) { |
| 92 | 86 | $this->headers = new Headers(); |
| 93 | 87 | } |
@@ -98,24 +92,21 @@ discard block |
||
| 98 | 92 | /** |
| 99 | 93 | * @param Headers $headers |
| 100 | 94 | */ |
| 101 | - public function setHeaders(Headers $headers) |
|
| 102 | - { |
|
| 95 | + public function setHeaders(Headers $headers) { |
|
| 103 | 96 | $this->headers = $headers; |
| 104 | 97 | } |
| 105 | 98 | |
| 106 | 99 | /** |
| 107 | 100 | * @return string |
| 108 | 101 | */ |
| 109 | - public function getBody() |
|
| 110 | - { |
|
| 102 | + public function getBody() { |
|
| 111 | 103 | return $this->body; |
| 112 | 104 | } |
| 113 | 105 | |
| 114 | 106 | /** |
| 115 | 107 | * @param string $body |
| 116 | 108 | */ |
| 117 | - public function setBody($body) |
|
| 118 | - { |
|
| 109 | + public function setBody($body) { |
|
| 119 | 110 | $this->body = $body; |
| 120 | 111 | $this->content = null; |
| 121 | 112 | } |
@@ -123,8 +114,7 @@ discard block |
||
| 123 | 114 | /** |
| 124 | 115 | * @return array|null |
| 125 | 116 | */ |
| 126 | - public function getContent() |
|
| 127 | - { |
|
| 117 | + public function getContent() { |
|
| 128 | 118 | if ($this->content === null) { |
| 129 | 119 | $this->content = json_decode($this->getBody(), true); |
| 130 | 120 | } |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http; |
| 26 | 26 | |
| 27 | -class Request implements RequestInterface |
|
| 28 | -{ |
|
| 27 | +class Request implements RequestInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @var string |
| 31 | 30 | */ |
@@ -89,13 +88,11 @@ discard block |
||
| 89 | 88 | /** |
| 90 | 89 | * @param Client $client |
| 91 | 90 | */ |
| 92 | - public function __construct(Client $client) |
|
| 93 | - { |
|
| 91 | + public function __construct(Client $client) { |
|
| 94 | 92 | $this->client = $client; |
| 95 | 93 | } |
| 96 | 94 | |
| 97 | - public function __clone() |
|
| 98 | - { |
|
| 95 | + public function __clone() { |
|
| 99 | 96 | $this->queryParams && $this->queryParams = clone $this->queryParams; |
| 100 | 97 | $this->bodyParams && $this->bodyParams = clone $this->bodyParams; |
| 101 | 98 | $this->fileParams && $this->fileParams = clone $this->fileParams; |
@@ -104,32 +101,28 @@ discard block |
||
| 104 | 101 | /** |
| 105 | 102 | * @return Client |
| 106 | 103 | */ |
| 107 | - public function getClient() |
|
| 108 | - { |
|
| 104 | + public function getClient() { |
|
| 109 | 105 | return $this->client; |
| 110 | 106 | } |
| 111 | 107 | |
| 112 | 108 | /** |
| 113 | 109 | * @return string |
| 114 | 110 | */ |
| 115 | - public function getProtocol() |
|
| 116 | - { |
|
| 111 | + public function getProtocol() { |
|
| 117 | 112 | return $this->protocol; |
| 118 | 113 | } |
| 119 | 114 | |
| 120 | 115 | /** |
| 121 | 116 | * @param string $protocol |
| 122 | 117 | */ |
| 123 | - public function setProtocol($protocol) |
|
| 124 | - { |
|
| 118 | + public function setProtocol($protocol) { |
|
| 125 | 119 | $this->protocol = $protocol; |
| 126 | 120 | } |
| 127 | 121 | |
| 128 | 122 | /** |
| 129 | 123 | * @return string |
| 130 | 124 | */ |
| 131 | - public function getDomain() |
|
| 132 | - { |
|
| 125 | + public function getDomain() { |
|
| 133 | 126 | if ($this->domain === null) { |
| 134 | 127 | $this->domain = sprintf( |
| 135 | 128 | "%s.%s", |
@@ -144,16 +137,14 @@ discard block |
||
| 144 | 137 | /** |
| 145 | 138 | * @param string $domain |
| 146 | 139 | */ |
| 147 | - public function setDomain($domain) |
|
| 148 | - { |
|
| 140 | + public function setDomain($domain) { |
|
| 149 | 141 | $this->domain = $domain; |
| 150 | 142 | } |
| 151 | 143 | |
| 152 | 144 | /** |
| 153 | 145 | * @param string $last_level_domain |
| 154 | 146 | */ |
| 155 | - public function setLastLevelDomain($last_level_domain) |
|
| 156 | - { |
|
| 147 | + public function setLastLevelDomain($last_level_domain) { |
|
| 157 | 148 | $this->domain = sprintf( |
| 158 | 149 | "%s.%s", |
| 159 | 150 | $last_level_domain, |
@@ -164,8 +155,7 @@ discard block |
||
| 164 | 155 | /** |
| 165 | 156 | * @return Headers |
| 166 | 157 | */ |
| 167 | - public function getHeaders() |
|
| 168 | - { |
|
| 158 | + public function getHeaders() { |
|
| 169 | 159 | if ($this->headers === null) { |
| 170 | 160 | $this->headers = clone $this->getClient()->getDefaultRequestHeaderds(); |
| 171 | 161 | } |
@@ -176,64 +166,56 @@ discard block |
||
| 176 | 166 | /** |
| 177 | 167 | * @param Headers $headers |
| 178 | 168 | */ |
| 179 | - public function setHeaders(Headers $headers) |
|
| 180 | - { |
|
| 169 | + public function setHeaders(Headers $headers) { |
|
| 181 | 170 | $this->headers = $headers; |
| 182 | 171 | } |
| 183 | 172 | |
| 184 | 173 | /** |
| 185 | 174 | * @return string |
| 186 | 175 | */ |
| 187 | - public function getMethod() |
|
| 188 | - { |
|
| 176 | + public function getMethod() { |
|
| 189 | 177 | return $this->method; |
| 190 | 178 | } |
| 191 | 179 | |
| 192 | 180 | /** |
| 193 | 181 | * @param string $method |
| 194 | 182 | */ |
| 195 | - public function setMethod($method) |
|
| 196 | - { |
|
| 183 | + public function setMethod($method) { |
|
| 197 | 184 | $this->method = $method; |
| 198 | 185 | } |
| 199 | 186 | |
| 200 | 187 | /** |
| 201 | 188 | * @return string |
| 202 | 189 | */ |
| 203 | - public function getPath() |
|
| 204 | - { |
|
| 190 | + public function getPath() { |
|
| 205 | 191 | return $this->path; |
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | /** |
| 209 | 195 | * @param string $path |
| 210 | 196 | */ |
| 211 | - public function setPath($path) |
|
| 212 | - { |
|
| 197 | + public function setPath($path) { |
|
| 213 | 198 | $this->path = $path; |
| 214 | 199 | } |
| 215 | 200 | |
| 216 | 201 | /** |
| 217 | 202 | * @return string |
| 218 | 203 | */ |
| 219 | - public function getGraphVersion() |
|
| 220 | - { |
|
| 204 | + public function getGraphVersion() { |
|
| 221 | 205 | return $this->graphVersion; |
| 222 | 206 | } |
| 223 | 207 | |
| 224 | 208 | /** |
| 225 | 209 | * @param string $version |
| 226 | 210 | */ |
| 227 | - public function setGraphVersion($version) |
|
| 228 | - { |
|
| 211 | + public function setGraphVersion($version) { |
|
| 229 | 212 | $this->graphVersion = $version; |
| 230 | 213 | } |
| 231 | 214 | |
| 232 | 215 | /** |
| 233 | 216 | * @return Parameters |
| 234 | 217 | */ |
| 235 | - public function getQueryParams() |
|
| 236 | - { |
|
| 218 | + public function getQueryParams() { |
|
| 237 | 219 | if ($this->queryParams === null) { |
| 238 | 220 | $this->queryParams = new Parameters(); |
| 239 | 221 | } |
@@ -244,16 +226,14 @@ discard block |
||
| 244 | 226 | /** |
| 245 | 227 | * @param Parameters $params |
| 246 | 228 | */ |
| 247 | - public function setQueryParams(Parameters $params) |
|
| 248 | - { |
|
| 229 | + public function setQueryParams(Parameters $params) { |
|
| 249 | 230 | $this->queryParams = $params; |
| 250 | 231 | } |
| 251 | 232 | |
| 252 | 233 | /** |
| 253 | 234 | * @return string |
| 254 | 235 | */ |
| 255 | - public function getUrl() |
|
| 256 | - { |
|
| 236 | + public function getUrl() { |
|
| 257 | 237 | return $this->getProtocol().$this->getDomain() |
| 258 | 238 | .'/v'.$this->getGraphVersion().$this->getPath() |
| 259 | 239 | .($this->getQueryParams()->count() ? '?' : null) |
@@ -263,8 +243,7 @@ discard block |
||
| 263 | 243 | /** |
| 264 | 244 | * @return Parameters |
| 265 | 245 | */ |
| 266 | - public function getBodyParams() |
|
| 267 | - { |
|
| 246 | + public function getBodyParams() { |
|
| 268 | 247 | if ($this->bodyParams === null) { |
| 269 | 248 | $this->bodyParams = new Parameters(); |
| 270 | 249 | } |
@@ -275,16 +254,14 @@ discard block |
||
| 275 | 254 | /** |
| 276 | 255 | * @param Parameters $params |
| 277 | 256 | */ |
| 278 | - public function setBodyParams(Parameters $params) |
|
| 279 | - { |
|
| 257 | + public function setBodyParams(Parameters $params) { |
|
| 280 | 258 | $this->bodyParams = $params; |
| 281 | 259 | } |
| 282 | 260 | |
| 283 | 261 | /** |
| 284 | 262 | * @return Parameters |
| 285 | 263 | */ |
| 286 | - public function getFileParams() |
|
| 287 | - { |
|
| 264 | + public function getFileParams() { |
|
| 288 | 265 | if ($this->fileParams === null) { |
| 289 | 266 | $this->fileParams = new Parameters(); |
| 290 | 267 | } |
@@ -295,16 +272,14 @@ discard block |
||
| 295 | 272 | /** |
| 296 | 273 | * @param Parameters $params |
| 297 | 274 | */ |
| 298 | - public function setFileParams(Parameters $params) |
|
| 299 | - { |
|
| 275 | + public function setFileParams(Parameters $params) { |
|
| 300 | 276 | $this->fileParams = $params; |
| 301 | 277 | } |
| 302 | 278 | |
| 303 | 279 | /** |
| 304 | 280 | * @return ResponseInterface |
| 305 | 281 | */ |
| 306 | - public function execute() |
|
| 307 | - { |
|
| 282 | + public function execute() { |
|
| 308 | 283 | return $this->getClient()->sendRequest($this); |
| 309 | 284 | } |
| 310 | 285 | |
@@ -312,8 +287,7 @@ discard block |
||
| 312 | 287 | * @return Request |
| 313 | 288 | * @see RequestInterface::createClone() |
| 314 | 289 | */ |
| 315 | - public function createClone() |
|
| 316 | - { |
|
| 290 | + public function createClone() { |
|
| 317 | 291 | return clone $this; |
| 318 | 292 | } |
| 319 | 293 | } |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http; |
| 26 | 26 | |
| 27 | -interface RequestInterface |
|
| 28 | -{ |
|
| 27 | +interface RequestInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @var string |
| 31 | 30 | */ |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http; |
| 26 | 26 | |
| 27 | -interface ResponseInterface |
|
| 28 | -{ |
|
| 27 | +interface ResponseInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @return RequestInterface |
| 31 | 30 | */ |
@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class AuthorizationException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class AuthorizationException extends RequestException { |
|
| 29 | 28 | } |
@@ -24,13 +24,11 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class EmptyResponseException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class EmptyResponseException extends RequestException { |
|
| 29 | 28 | /** |
| 30 | 29 | * @param int $status_code |
| 31 | 30 | */ |
| 32 | - public function __construct($status_code) |
|
| 33 | - { |
|
| 31 | + public function __construct($status_code) { |
|
| 34 | 32 | parent::__construct(array( |
| 35 | 33 | 'error' => array( |
| 36 | 34 | 'message' => 'Empty Response', |
@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class ClientException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class ClientException extends RequestException { |
|
| 29 | 28 | } |
@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class ThrottleException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class ThrottleException extends RequestException { |
|
| 29 | 28 | } |