@@ -90,7 +90,7 @@ |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @return Api|null |
|
| 93 | + * @return Api |
|
| 94 | 94 | */ |
| 95 | 95 | public static function instance() |
| 96 | 96 | { |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | use FacebookAds\Logger\LoggerInterface; |
| 31 | 31 | use FacebookAds\Logger\NullLogger; |
| 32 | 32 | |
| 33 | -class Api |
|
| 34 | -{ |
|
| 33 | +class Api { |
|
| 35 | 34 | /** |
| 36 | 35 | * @var string |
| 37 | 36 | */ |
@@ -80,8 +79,7 @@ discard block |
||
| 80 | 79 | * @param string $access_token |
| 81 | 80 | * @return static |
| 82 | 81 | */ |
| 83 | - public static function init($app_id, $app_secret, $access_token) |
|
| 84 | - { |
|
| 82 | + public static function init($app_id, $app_secret, $access_token) { |
|
| 85 | 83 | $session = new Session($app_id, $app_secret, $access_token); |
| 86 | 84 | $api = new static(new Client(), $session); |
| 87 | 85 | static::setInstance($api); |
@@ -92,16 +90,14 @@ discard block |
||
| 92 | 90 | /** |
| 93 | 91 | * @return Api|null |
| 94 | 92 | */ |
| 95 | - public static function instance() |
|
| 96 | - { |
|
| 93 | + public static function instance() { |
|
| 97 | 94 | return static::$instance; |
| 98 | 95 | } |
| 99 | 96 | |
| 100 | 97 | /** |
| 101 | 98 | * @param Api $instance |
| 102 | 99 | */ |
| 103 | - public static function setInstance(Api $instance) |
|
| 104 | - { |
|
| 100 | + public static function setInstance(Api $instance) { |
|
| 105 | 101 | static::$instance = $instance; |
| 106 | 102 | } |
| 107 | 103 | |
@@ -109,8 +105,7 @@ discard block |
||
| 109 | 105 | * @param string $string |
| 110 | 106 | * @return string |
| 111 | 107 | */ |
| 112 | - public static function base64UrlEncode($string) |
|
| 113 | - { |
|
| 108 | + public static function base64UrlEncode($string) { |
|
| 114 | 109 | $str = strtr(base64_encode($string), '+/', '-_'); |
| 115 | 110 | $str = str_replace('=', '', $str); |
| 116 | 111 | return $str; |
@@ -151,8 +146,7 @@ discard block |
||
| 151 | 146 | * @param RequestInterface $request |
| 152 | 147 | * @return ResponseInterface |
| 153 | 148 | */ |
| 154 | - public function executeRequest(RequestInterface $request) |
|
| 155 | - { |
|
| 149 | + public function executeRequest(RequestInterface $request) { |
|
| 156 | 150 | $this->getLogger()->logRequest('debug', $request); |
| 157 | 151 | $response = $request->execute(); |
| 158 | 152 | $this->getLogger()->logResponse('debug', $response); |
@@ -163,8 +157,7 @@ discard block |
||
| 163 | 157 | /** |
| 164 | 158 | * @return string |
| 165 | 159 | */ |
| 166 | - public function getDefaultGraphVersion() |
|
| 167 | - { |
|
| 160 | + public function getDefaultGraphVersion() { |
|
| 168 | 161 | if ($this->defaultGraphVersion === null) { |
| 169 | 162 | $match = array(); |
| 170 | 163 | if (preg_match("/^\d+\.\d+/", static::VERSION, $match)) { |
@@ -178,8 +171,7 @@ discard block |
||
| 178 | 171 | /** |
| 179 | 172 | * @param string $version |
| 180 | 173 | */ |
| 181 | - public function setDefaultGraphVersion($version) |
|
| 182 | - { |
|
| 174 | + public function setDefaultGraphVersion($version) { |
|
| 183 | 175 | $this->defaultGraphVersion = $version; |
| 184 | 176 | } |
| 185 | 177 | |
@@ -204,24 +196,21 @@ discard block |
||
| 204 | 196 | /** |
| 205 | 197 | * @return Session |
| 206 | 198 | */ |
| 207 | - public function getSession() |
|
| 208 | - { |
|
| 199 | + public function getSession() { |
|
| 209 | 200 | return $this->session; |
| 210 | 201 | } |
| 211 | 202 | |
| 212 | 203 | /** |
| 213 | 204 | * @param LoggerInterface $logger |
| 214 | 205 | */ |
| 215 | - public function setLogger(LoggerInterface $logger) |
|
| 216 | - { |
|
| 206 | + public function setLogger(LoggerInterface $logger) { |
|
| 217 | 207 | $this->logger = $logger; |
| 218 | 208 | } |
| 219 | 209 | |
| 220 | 210 | /** |
| 221 | 211 | * @return LoggerInterface |
| 222 | 212 | */ |
| 223 | - public function getLogger() |
|
| 224 | - { |
|
| 213 | + public function getLogger() { |
|
| 225 | 214 | if ($this->logger === null) { |
| 226 | 215 | $this->logger = new NullLogger(); |
| 227 | 216 | } |
@@ -232,8 +221,7 @@ discard block |
||
| 232 | 221 | /** |
| 233 | 222 | * @return Client |
| 234 | 223 | */ |
| 235 | - public function getHttpClient() |
|
| 236 | - { |
|
| 224 | + public function getHttpClient() { |
|
| 237 | 225 | return $this->httpClient; |
| 238 | 226 | } |
| 239 | 227 | } |
@@ -499,7 +499,7 @@ |
||
| 499 | 499 | |
| 500 | 500 | /** |
| 501 | 501 | * @param mixed $offset |
| 502 | - * @return mixed |
|
| 502 | + * @return AbstractObject|null |
|
| 503 | 503 | */ |
| 504 | 504 | public function offsetGet($offset) |
| 505 | 505 | { |
@@ -84,8 +84,7 @@ discard block |
||
| 84 | 84 | * @param array $object_data |
| 85 | 85 | * @return AbstractObject |
| 86 | 86 | */ |
| 87 | - protected function createObject(array $object_data) |
|
| 88 | - { |
|
| 87 | + protected function createObject(array $object_data) { |
|
| 89 | 88 | $object = clone $this->objectPrototype; |
| 90 | 89 | $object->setDataWithoutValidation($object_data); |
| 91 | 90 | |
@@ -97,8 +96,7 @@ discard block |
||
| 97 | 96 | * @return array |
| 98 | 97 | * @throws \InvalidArgumentException |
| 99 | 98 | */ |
| 100 | - protected function assureResponseData(ResponseInterface $response) |
|
| 101 | - { |
|
| 99 | + protected function assureResponseData(ResponseInterface $response) { |
|
| 102 | 100 | $content = $response->getContent(); |
| 103 | 101 | if (!isset($content['data']) || !is_array($content['data'])) { |
| 104 | 102 | throw new \InvalidArgumentException("Malformed response data"); |
@@ -110,8 +108,7 @@ discard block |
||
| 110 | 108 | /** |
| 111 | 109 | * @param ResponseInterface $response |
| 112 | 110 | */ |
| 113 | - protected function prependResponse(ResponseInterface $response) |
|
| 114 | - { |
|
| 111 | + protected function prependResponse(ResponseInterface $response) { |
|
| 115 | 112 | $this->response = $response; |
| 116 | 113 | $data = $this->assureResponseData($response); |
| 117 | 114 | if (empty($data)) { |
@@ -130,8 +127,7 @@ discard block |
||
| 130 | 127 | /** |
| 131 | 128 | * @param ResponseInterface $response |
| 132 | 129 | */ |
| 133 | - protected function appendResponse(ResponseInterface $response) |
|
| 134 | - { |
|
| 130 | + protected function appendResponse(ResponseInterface $response) { |
|
| 135 | 131 | $this->response = $response; |
| 136 | 132 | $data = $this->assureResponseData($response); |
| 137 | 133 | if (empty($data)) { |
@@ -154,24 +150,21 @@ discard block |
||
| 154 | 150 | /** |
| 155 | 151 | * @return bool |
| 156 | 152 | */ |
| 157 | - public static function getDefaultUseImplicitFetch() |
|
| 158 | - { |
|
| 153 | + public static function getDefaultUseImplicitFetch() { |
|
| 159 | 154 | return static::$defaultUseImplicitFetch; |
| 160 | 155 | } |
| 161 | 156 | |
| 162 | 157 | /** |
| 163 | 158 | * @param bool $use_implicit_fectch |
| 164 | 159 | */ |
| 165 | - public static function setDefaultUseImplicitFetch($use_implicit_fectch) |
|
| 166 | - { |
|
| 160 | + public static function setDefaultUseImplicitFetch($use_implicit_fectch) { |
|
| 167 | 161 | static::$defaultUseImplicitFetch = $use_implicit_fectch; |
| 168 | 162 | } |
| 169 | 163 | |
| 170 | 164 | /** |
| 171 | 165 | * @return bool |
| 172 | 166 | */ |
| 173 | - public function getUseImplicitFetch() |
|
| 174 | - { |
|
| 167 | + public function getUseImplicitFetch() { |
|
| 175 | 168 | return $this->useImplicitFectch !== null |
| 176 | 169 | ? $this->useImplicitFectch |
| 177 | 170 | : static::$defaultUseImplicitFetch; |
@@ -180,16 +173,14 @@ discard block |
||
| 180 | 173 | /** |
| 181 | 174 | * @param bool $use_implicit_fectch |
| 182 | 175 | */ |
| 183 | - public function setUseImplicitFetch($use_implicit_fectch) |
|
| 184 | - { |
|
| 176 | + public function setUseImplicitFetch($use_implicit_fectch) { |
|
| 185 | 177 | $this->useImplicitFectch = $use_implicit_fectch; |
| 186 | 178 | } |
| 187 | 179 | |
| 188 | 180 | /** |
| 189 | 181 | * @return string|null |
| 190 | 182 | */ |
| 191 | - public function getBefore() |
|
| 192 | - { |
|
| 183 | + public function getBefore() { |
|
| 193 | 184 | $content = $this->getLastResponse()->getContent(); |
| 194 | 185 | |
| 195 | 186 | return isset($content['paging']['cursors']['before']) |
@@ -200,8 +191,7 @@ discard block |
||
| 200 | 191 | /** |
| 201 | 192 | * @return string|null |
| 202 | 193 | */ |
| 203 | - public function getAfter() |
|
| 204 | - { |
|
| 194 | + public function getAfter() { |
|
| 205 | 195 | $content = $this->getLastResponse()->getContent(); |
| 206 | 196 | |
| 207 | 197 | return isset($content['paging']['cursors']['after']) |
@@ -212,8 +202,7 @@ discard block |
||
| 212 | 202 | /** |
| 213 | 203 | * @return RequestInterface |
| 214 | 204 | */ |
| 215 | - protected function createUndirectionalizedRequest() |
|
| 216 | - { |
|
| 205 | + protected function createUndirectionalizedRequest() { |
|
| 217 | 206 | $request = $this->getLastResponse()->getRequest()->createClone(); |
| 218 | 207 | $params = $request->getQueryParams(); |
| 219 | 208 | if (array_key_exists('before', $params)) { |
@@ -229,8 +218,7 @@ discard block |
||
| 229 | 218 | /** |
| 230 | 219 | * @return string|null |
| 231 | 220 | */ |
| 232 | - public function getPrevious() |
|
| 233 | - { |
|
| 221 | + public function getPrevious() { |
|
| 234 | 222 | $content = $this->getLastResponse()->getContent(); |
| 235 | 223 | if (isset($content['paging']['previous'])) { |
| 236 | 224 | return $content['paging']['previous']; |
@@ -249,8 +237,7 @@ discard block |
||
| 249 | 237 | /** |
| 250 | 238 | * @return string|null |
| 251 | 239 | */ |
| 252 | - public function getNext() |
|
| 253 | - { |
|
| 240 | + public function getNext() { |
|
| 254 | 241 | $content = $this->getLastResponse()->getContent(); |
| 255 | 242 | if (isset($content['paging']['next'])) { |
| 256 | 243 | return $content['paging']['next']; |
@@ -270,8 +257,7 @@ discard block |
||
| 270 | 257 | * @param string $url |
| 271 | 258 | * @return RequestInterface |
| 272 | 259 | */ |
| 273 | - protected function createRequestFromUrl($url) |
|
| 274 | - { |
|
| 260 | + protected function createRequestFromUrl($url) { |
|
| 275 | 261 | $components = parse_url($url); |
| 276 | 262 | $request = $this->getLastResponse()->getRequest()->createClone(); |
| 277 | 263 | $request->setDomain($components['host']); |
@@ -286,8 +272,7 @@ discard block |
||
| 286 | 272 | /** |
| 287 | 273 | * @return RequestInterface|null |
| 288 | 274 | */ |
| 289 | - public function createBeforeRequest() |
|
| 290 | - { |
|
| 275 | + public function createBeforeRequest() { |
|
| 291 | 276 | $url = $this->getPrevious(); |
| 292 | 277 | return $url !== null ? $this->createRequestFromUrl($url) : null; |
| 293 | 278 | } |
@@ -295,14 +280,12 @@ discard block |
||
| 295 | 280 | /** |
| 296 | 281 | * @return RequestInterface|null |
| 297 | 282 | */ |
| 298 | - public function createAfterRequest() |
|
| 299 | - { |
|
| 283 | + public function createAfterRequest() { |
|
| 300 | 284 | $url = $this->getNext(); |
| 301 | 285 | return $url !== null ? $this->createRequestFromUrl($url) : null; |
| 302 | 286 | } |
| 303 | 287 | |
| 304 | - public function fetchBefore() |
|
| 305 | - { |
|
| 288 | + public function fetchBefore() { |
|
| 306 | 289 | $request = $this->createBeforeRequest(); |
| 307 | 290 | if (!$request) { |
| 308 | 291 | return; |
@@ -311,8 +294,7 @@ discard block |
||
| 311 | 294 | $this->prependResponse($request->execute()); |
| 312 | 295 | } |
| 313 | 296 | |
| 314 | - public function fetchAfter() |
|
| 315 | - { |
|
| 297 | + public function fetchAfter() { |
|
| 316 | 298 | $request = $this->createAfterRequest(); |
| 317 | 299 | if (!$request) { |
| 318 | 300 | return; |
@@ -325,8 +307,7 @@ discard block |
||
| 325 | 307 | * @deprecated Use getArrayCopy() |
| 326 | 308 | * @return AbstractObject[] |
| 327 | 309 | */ |
| 328 | - public function getObjects() |
|
| 329 | - { |
|
| 310 | + public function getObjects() { |
|
| 330 | 311 | return $this->objects; |
| 331 | 312 | } |
| 332 | 313 | |
@@ -334,8 +315,7 @@ discard block |
||
| 334 | 315 | * @param bool $ksort |
| 335 | 316 | * @return AbstractObject[] |
| 336 | 317 | */ |
| 337 | - public function getArrayCopy($ksort = false) |
|
| 338 | - { |
|
| 318 | + public function getArrayCopy($ksort = false) { |
|
| 339 | 319 | if ($ksort) { |
| 340 | 320 | // Sort the main array to improve best case performance in future |
| 341 | 321 | // invocations |
@@ -349,50 +329,43 @@ discard block |
||
| 349 | 329 | * @deprecated Use getLastResponse() |
| 350 | 330 | * @return ResponseInterface |
| 351 | 331 | */ |
| 352 | - public function getResponse() |
|
| 353 | - { |
|
| 332 | + public function getResponse() { |
|
| 354 | 333 | return $this->response; |
| 355 | 334 | } |
| 356 | 335 | |
| 357 | 336 | /** |
| 358 | 337 | * @return ResponseInterface |
| 359 | 338 | */ |
| 360 | - public function getLastResponse() |
|
| 361 | - { |
|
| 339 | + public function getLastResponse() { |
|
| 362 | 340 | return $this->response; |
| 363 | 341 | } |
| 364 | 342 | |
| 365 | 343 | /** |
| 366 | 344 | * @return int |
| 367 | 345 | */ |
| 368 | - public function getIndexLeft() |
|
| 369 | - { |
|
| 346 | + public function getIndexLeft() { |
|
| 370 | 347 | return $this->indexLeft; |
| 371 | 348 | } |
| 372 | 349 | |
| 373 | 350 | /** |
| 374 | 351 | * @return int |
| 375 | 352 | */ |
| 376 | - public function getIndexRight() |
|
| 377 | - { |
|
| 353 | + public function getIndexRight() { |
|
| 378 | 354 | return $this->indexRight; |
| 379 | 355 | } |
| 380 | 356 | |
| 381 | - public function rewind() |
|
| 382 | - { |
|
| 357 | + public function rewind() { |
|
| 383 | 358 | $this->position = $this->indexLeft; |
| 384 | 359 | } |
| 385 | 360 | |
| 386 | - public function end() |
|
| 387 | - { |
|
| 361 | + public function end() { |
|
| 388 | 362 | $this->position = $this->indexRight; |
| 389 | 363 | } |
| 390 | 364 | |
| 391 | 365 | /** |
| 392 | 366 | * @param int $position |
| 393 | 367 | */ |
| 394 | - public function seekTo($position) |
|
| 395 | - { |
|
| 368 | + public function seekTo($position) { |
|
| 396 | 369 | $position = array_key_exists($position, $this->objects) ? $position : null; |
| 397 | 370 | $this->position = $position; |
| 398 | 371 | } |
@@ -400,8 +373,7 @@ discard block |
||
| 400 | 373 | /** |
| 401 | 374 | * @return AbstractObject|bool |
| 402 | 375 | */ |
| 403 | - public function current() |
|
| 404 | - { |
|
| 376 | + public function current() { |
|
| 405 | 377 | return isset($this->objects[$this->position]) |
| 406 | 378 | ? $this->objects[$this->position] |
| 407 | 379 | : false; |
@@ -410,13 +382,11 @@ discard block |
||
| 410 | 382 | /** |
| 411 | 383 | * @return int |
| 412 | 384 | */ |
| 413 | - public function key() |
|
| 414 | - { |
|
| 385 | + public function key() { |
|
| 415 | 386 | return $this->position; |
| 416 | 387 | } |
| 417 | 388 | |
| 418 | - public function prev() |
|
| 419 | - { |
|
| 389 | + public function prev() { |
|
| 420 | 390 | if ($this->position == $this->getIndexLeft()) { |
| 421 | 391 | if ($this->getUseImplicitFetch()) { |
| 422 | 392 | $this->fetchBefore(); |
@@ -433,8 +403,7 @@ discard block |
||
| 433 | 403 | } |
| 434 | 404 | } |
| 435 | 405 | |
| 436 | - public function next() |
|
| 437 | - { |
|
| 406 | + public function next() { |
|
| 438 | 407 | if ($this->position == $this->getIndexRight()) { |
| 439 | 408 | if ($this->getUseImplicitFetch()) { |
| 440 | 409 | $this->fetchAfter(); |
@@ -454,16 +423,14 @@ discard block |
||
| 454 | 423 | /** |
| 455 | 424 | * @return bool |
| 456 | 425 | */ |
| 457 | - public function valid() |
|
| 458 | - { |
|
| 426 | + public function valid() { |
|
| 459 | 427 | return isset($this->objects[$this->position]); |
| 460 | 428 | } |
| 461 | 429 | |
| 462 | 430 | /** |
| 463 | 431 | * @return int |
| 464 | 432 | */ |
| 465 | - public function count() |
|
| 466 | - { |
|
| 433 | + public function count() { |
|
| 467 | 434 | return count($this->objects); |
| 468 | 435 | } |
| 469 | 436 | |
@@ -471,8 +438,7 @@ discard block |
||
| 471 | 438 | * @param mixed $offset |
| 472 | 439 | * @param mixed $value |
| 473 | 440 | */ |
| 474 | - public function offsetSet($offset, $value) |
|
| 475 | - { |
|
| 441 | + public function offsetSet($offset, $value) { |
|
| 476 | 442 | if ($offset === null) { |
| 477 | 443 | $this->objects[] = $value; |
| 478 | 444 | } else { |
@@ -484,16 +450,14 @@ discard block |
||
| 484 | 450 | * @param mixed $offset |
| 485 | 451 | * @return bool |
| 486 | 452 | */ |
| 487 | - public function offsetExists($offset) |
|
| 488 | - { |
|
| 453 | + public function offsetExists($offset) { |
|
| 489 | 454 | return isset($this->objects[$offset]); |
| 490 | 455 | } |
| 491 | 456 | |
| 492 | 457 | /** |
| 493 | 458 | * @param mixed $offset |
| 494 | 459 | */ |
| 495 | - public function offsetUnset($offset) |
|
| 496 | - { |
|
| 460 | + public function offsetUnset($offset) { |
|
| 497 | 461 | unset($this->objects[$offset]); |
| 498 | 462 | } |
| 499 | 463 | |
@@ -501,8 +465,7 @@ discard block |
||
| 501 | 465 | * @param mixed $offset |
| 502 | 466 | * @return mixed |
| 503 | 467 | */ |
| 504 | - public function offsetGet($offset) |
|
| 505 | - { |
|
| 468 | + public function offsetGet($offset) { |
|
| 506 | 469 | return isset($this->objects[$offset]) ? $this->objects[$offset] : null; |
| 507 | 470 | } |
| 508 | 471 | } |
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * @param array $array |
| 210 | - * @param mixed $key |
|
| 210 | + * @param string $key |
|
| 211 | 211 | * @return mixed |
| 212 | 212 | */ |
| 213 | 213 | protected function removeArrayKey(array &$array, $key) |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | use FacebookAds\Http\ResponseInterface; |
| 30 | 30 | use FacebookAds\Logger\CurlLogger\JsonAwareParameters; |
| 31 | 31 | |
| 32 | -class CurlLogger implements LoggerInterface |
|
| 33 | -{ |
|
| 32 | +class CurlLogger implements LoggerInterface { |
|
| 34 | 33 | /** |
| 35 | 34 | * @var string |
| 36 | 35 | */ |
@@ -79,16 +78,14 @@ discard block |
||
| 79 | 78 | /** |
| 80 | 79 | * @param resource $handle |
| 81 | 80 | */ |
| 82 | - public function __construct($handle = null) |
|
| 83 | - { |
|
| 81 | + public function __construct($handle = null) { |
|
| 84 | 82 | $this->handle = is_resource($handle) ? $handle : STDOUT; |
| 85 | 83 | } |
| 86 | 84 | |
| 87 | 85 | /** |
| 88 | 86 | * @return bool |
| 89 | 87 | */ |
| 90 | - public function isJsonPrettyPrint() |
|
| 91 | - { |
|
| 88 | + public function isJsonPrettyPrint() { |
|
| 92 | 89 | return $this->jsonPrettyPrint; |
| 93 | 90 | } |
| 94 | 91 | |
@@ -96,8 +93,7 @@ discard block |
||
| 96 | 93 | * @param bool $json_pretty_print |
| 97 | 94 | * @return $this |
| 98 | 95 | */ |
| 99 | - public function setJsonPrettyPrint($json_pretty_print) |
|
| 100 | - { |
|
| 96 | + public function setJsonPrettyPrint($json_pretty_print) { |
|
| 101 | 97 | $this->jsonPrettyPrint = $json_pretty_print; |
| 102 | 98 | |
| 103 | 99 | return $this; |
@@ -107,8 +103,7 @@ discard block |
||
| 107 | 103 | * @param string $method |
| 108 | 104 | * @return string |
| 109 | 105 | */ |
| 110 | - public static function getMethodFlag($method) |
|
| 111 | - { |
|
| 106 | + public static function getMethodFlag($method) { |
|
| 112 | 107 | switch ($method) { |
| 113 | 108 | case RequestInterface::METHOD_GET: |
| 114 | 109 | return static::METHOD_GET_FLAG; |
@@ -126,8 +121,7 @@ discard block |
||
| 126 | 121 | * @param string $value |
| 127 | 122 | * @return string |
| 128 | 123 | */ |
| 129 | - public static function getParamFlag($method, $value) |
|
| 130 | - { |
|
| 124 | + public static function getParamFlag($method, $value) { |
|
| 131 | 125 | return $method === RequestInterface::METHOD_POST |
| 132 | 126 | ? static::PARAM_POST_FLAG |
| 133 | 127 | : (strstr($value, "\n") |
@@ -140,8 +134,7 @@ discard block |
||
| 140 | 134 | * @param int $indent |
| 141 | 135 | * @return string |
| 142 | 136 | */ |
| 143 | - protected function indent($string, $indent) |
|
| 144 | - { |
|
| 137 | + protected function indent($string, $indent) { |
|
| 145 | 138 | return str_replace("\n", " \n".str_repeat(' ', $indent), $string); |
| 146 | 139 | } |
| 147 | 140 | |
@@ -151,8 +144,7 @@ discard block |
||
| 151 | 144 | * @param bool $is_file |
| 152 | 145 | * @return string |
| 153 | 146 | */ |
| 154 | - protected function processParams(Parameters $params, $method, $is_file) |
|
| 155 | - { |
|
| 147 | + protected function processParams(Parameters $params, $method, $is_file) { |
|
| 156 | 148 | $chunks = array(); |
| 157 | 149 | if ($this->isJsonPrettyPrint()) { |
| 158 | 150 | $params = new JsonAwareParameters($params); |
@@ -181,8 +173,7 @@ discard block |
||
| 181 | 173 | * @param RequestInterface $request |
| 182 | 174 | * @return string |
| 183 | 175 | */ |
| 184 | - protected function processUrl(RequestInterface $request) |
|
| 185 | - { |
|
| 176 | + protected function processUrl(RequestInterface $request) { |
|
| 186 | 177 | return $request->getProtocol().$request->getDomain() |
| 187 | 178 | .'/v'.$request->getGraphVersion().$request->getPath(); |
| 188 | 179 | } |
@@ -190,8 +181,7 @@ discard block |
||
| 190 | 181 | /** |
| 191 | 182 | * @param string $buffer |
| 192 | 183 | */ |
| 193 | - protected function flush($buffer) |
|
| 194 | - { |
|
| 184 | + protected function flush($buffer) { |
|
| 195 | 185 | fwrite($this->handle, $buffer.PHP_EOL.PHP_EOL); |
| 196 | 186 | } |
| 197 | 187 | |
@@ -200,8 +190,7 @@ discard block |
||
| 200 | 190 | * @param string $message |
| 201 | 191 | * @param array $context |
| 202 | 192 | */ |
| 203 | - public function log($level, $message, array $context = array()) |
|
| 204 | - { |
|
| 193 | + public function log($level, $message, array $context = array()) { |
|
| 205 | 194 | // We only care about requests |
| 206 | 195 | } |
| 207 | 196 | |
@@ -210,8 +199,7 @@ discard block |
||
| 210 | 199 | * @param mixed $key |
| 211 | 200 | * @return mixed |
| 212 | 201 | */ |
| 213 | - protected function removeArrayKey(array &$array, $key) |
|
| 214 | - { |
|
| 202 | + protected function removeArrayKey(array &$array, $key) { |
|
| 215 | 203 | if (array_key_exists($key, $array)) { |
| 216 | 204 | $value = $array[$key]; |
| 217 | 205 | unset($array[$key]); |
@@ -226,8 +214,7 @@ discard block |
||
| 226 | 214 | * @param array $params |
| 227 | 215 | * @return array |
| 228 | 216 | */ |
| 229 | - protected function sortParams(array $params) |
|
| 230 | - { |
|
| 217 | + protected function sortParams(array $params) { |
|
| 231 | 218 | $access_token = $this->removeArrayKey($params, 'access_token'); |
| 232 | 219 | $appsecret_proof = $this->removeArrayKey($params, 'appsecret_proof'); |
| 233 | 220 | $access_token !== null && $params['access_token'] = $access_token; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * @param array $fields |
| 78 | 78 | * @param array $params |
| 79 | - * @return TargetingDescription |
|
| 79 | + * @return null|AbstractCrudObject |
|
| 80 | 80 | */ |
| 81 | 81 | public function getTargetingDescription( |
| 82 | 82 | array $fields = array(), array $params = array()) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * @param array $fields |
| 106 | 106 | * @param array $params |
| 107 | - * @return ReachEstimate |
|
| 107 | + * @return null|AbstractCrudObject |
|
| 108 | 108 | */ |
| 109 | 109 | public function getReachEstimate( |
| 110 | 110 | array $fields = array(), array $params = array()) |
@@ -30,24 +30,21 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Traits\FieldValidation; |
| 31 | 31 | |
| 32 | 32 | class Ad extends AbstractArchivableCrudObject |
| 33 | - implements CanRedownloadInterface |
|
| 34 | -{ |
|
| 33 | + implements CanRedownloadInterface { |
|
| 35 | 34 | use FieldValidation; |
| 36 | 35 | use AdLabelAwareCrudObjectTrait; |
| 37 | 36 | |
| 38 | 37 | /** |
| 39 | 38 | * @return string |
| 40 | 39 | */ |
| 41 | - protected function getEndpoint() |
|
| 42 | - { |
|
| 40 | + protected function getEndpoint() { |
|
| 43 | 41 | return 'ads'; |
| 44 | 42 | } |
| 45 | 43 | |
| 46 | 44 | /** |
| 47 | 45 | * @return AdFields |
| 48 | 46 | */ |
| 49 | - public static function getFieldsEnum() |
|
| 50 | - { |
|
| 47 | + public static function getFieldsEnum() { |
|
| 51 | 48 | return AdFields::getInstance(); |
| 52 | 49 | } |
| 53 | 50 | |
@@ -57,8 +54,7 @@ discard block |
||
| 57 | 54 | * @return Cursor |
| 58 | 55 | */ |
| 59 | 56 | public function getAdCreatives( |
| 60 | - array $fields = array(), array $params = array()) |
|
| 61 | - { |
|
| 57 | + array $fields = array(), array $params = array()) { |
|
| 62 | 58 | return $this->getManyByConnection( |
| 63 | 59 | AdCreative::className(), $fields, $params); |
| 64 | 60 | } |
@@ -68,8 +64,7 @@ discard block |
||
| 68 | 64 | * @param array $params |
| 69 | 65 | * @return Cursor |
| 70 | 66 | */ |
| 71 | - public function getLeads(array $fields = array(), array $params = array()) |
|
| 72 | - { |
|
| 67 | + public function getLeads(array $fields = array(), array $params = array()) { |
|
| 73 | 68 | return $this->getManyByConnection(Lead::className(), $fields, $params); |
| 74 | 69 | } |
| 75 | 70 | |
@@ -79,8 +74,7 @@ discard block |
||
| 79 | 74 | * @return TargetingDescription |
| 80 | 75 | */ |
| 81 | 76 | public function getTargetingDescription( |
| 82 | - array $fields = array(), array $params = array()) |
|
| 83 | - { |
|
| 77 | + array $fields = array(), array $params = array()) { |
|
| 84 | 78 | return $this->getOneByConnection( |
| 85 | 79 | TargetingDescription::className(), |
| 86 | 80 | $fields, |
@@ -95,8 +89,7 @@ discard block |
||
| 95 | 89 | * @return Cursor |
| 96 | 90 | */ |
| 97 | 91 | public function getAdPreviews( |
| 98 | - array $fields = array(), array $params = array()) |
|
| 99 | - { |
|
| 92 | + array $fields = array(), array $params = array()) { |
|
| 100 | 93 | return $this->getManyByConnection( |
| 101 | 94 | AdPreview::className(), $fields, $params, 'previews'); |
| 102 | 95 | } |
@@ -107,8 +100,7 @@ discard block |
||
| 107 | 100 | * @return ReachEstimate |
| 108 | 101 | */ |
| 109 | 102 | public function getReachEstimate( |
| 110 | - array $fields = array(), array $params = array()) |
|
| 111 | - { |
|
| 103 | + array $fields = array(), array $params = array()) { |
|
| 112 | 104 | return $this->getOneByConnection( |
| 113 | 105 | ReachEstimate::className(), $fields, $params, 'reachestimate'); |
| 114 | 106 | } |
@@ -119,8 +111,7 @@ discard block |
||
| 119 | 111 | * @return Cursor |
| 120 | 112 | */ |
| 121 | 113 | public function getClickTrackingTag( |
| 122 | - array $fields = array(), array $params = array()) |
|
| 123 | - { |
|
| 114 | + array $fields = array(), array $params = array()) { |
|
| 124 | 115 | return $this->getManyByConnection( |
| 125 | 116 | ClickTrackingTag::className(), $fields, $params, 'trackingtag'); |
| 126 | 117 | } |
@@ -131,8 +122,7 @@ discard block |
||
| 131 | 122 | * @return Cursor |
| 132 | 123 | */ |
| 133 | 124 | public function getInsights( |
| 134 | - array $fields = array(), array $params = array()) |
|
| 135 | - { |
|
| 125 | + array $fields = array(), array $params = array()) { |
|
| 136 | 126 | return $this->getManyByConnection( |
| 137 | 127 | Insights::classname(), $fields, $params, 'insights'); |
| 138 | 128 | } |
@@ -143,8 +133,7 @@ discard block |
||
| 143 | 133 | * @return AsyncJobInsights |
| 144 | 134 | */ |
| 145 | 135 | public function getInsightsAsync( |
| 146 | - array $fields = array(), array $params = array()) |
|
| 147 | - { |
|
| 136 | + array $fields = array(), array $params = array()) { |
|
| 148 | 137 | return $this->createAsyncJob( |
| 149 | 138 | AsyncJobInsights::className(), $fields, $params); |
| 150 | 139 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | /** |
| 233 | 233 | * @param array $fields |
| 234 | 234 | * @param array $params |
| 235 | - * @return ReachEstimate |
|
| 235 | + * @return null|AbstractCrudObject |
|
| 236 | 236 | */ |
| 237 | 237 | public function getReachEstimate( |
| 238 | 238 | array $fields = array(), array $params = array()) |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | /** |
| 257 | 257 | * @param array $fields |
| 258 | 258 | * @param array $params |
| 259 | - * @return TargetingDescription |
|
| 259 | + * @return null|AbstractCrudObject |
|
| 260 | 260 | */ |
| 261 | 261 | public function getTargetingDescription( |
| 262 | 262 | array $fields = array(), array $params = array()) |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
|
| 4 | - * |
|
| 5 | - * You are hereby granted a non-exclusive, worldwide, royalty-free license to |
|
| 6 | - * use, copy, modify, and distribute this software in source code or binary |
|
| 7 | - * form for use in connection with the web services and APIs provided by |
|
| 8 | - * Facebook. |
|
| 9 | - * |
|
| 10 | - * As with any software that integrates with the Facebook platform, your use |
|
| 11 | - * of this software is subject to the Facebook Developer Principles and |
|
| 12 | - * Policies [http://developers.facebook.com/policy/]. This copyright notice |
|
| 13 | - * shall be included in all copies or substantial portions of the software. |
|
| 14 | - * |
|
| 15 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 16 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 17 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
| 18 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 19 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 20 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
| 21 | - * DEALINGS IN THE SOFTWARE. |
|
| 22 | - * |
|
| 23 | - */ |
|
| 3 | + * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
|
| 4 | + * |
|
| 5 | + * You are hereby granted a non-exclusive, worldwide, royalty-free license to |
|
| 6 | + * use, copy, modify, and distribute this software in source code or binary |
|
| 7 | + * form for use in connection with the web services and APIs provided by |
|
| 8 | + * Facebook. |
|
| 9 | + * |
|
| 10 | + * As with any software that integrates with the Facebook platform, your use |
|
| 11 | + * of this software is subject to the Facebook Developer Principles and |
|
| 12 | + * Policies [http://developers.facebook.com/policy/]. This copyright notice |
|
| 13 | + * shall be included in all copies or substantial portions of the software. |
|
| 14 | + * |
|
| 15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
| 18 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 20 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
| 21 | + * DEALINGS IN THE SOFTWARE. |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | return $this->getManyByConnection(AdUser::className(), $fields, $params); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param array $fields |
|
| 80 | - * @param array $params |
|
| 81 | - * @return Cursor |
|
| 82 | - */ |
|
| 78 | + /** |
|
| 79 | + * @param array $fields |
|
| 80 | + * @param array $params |
|
| 81 | + * @return Cursor |
|
| 82 | + */ |
|
| 83 | 83 | public function getCampaigns( |
| 84 | 84 | array $fields = array(), array $params = array()) |
| 85 | 85 | { |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | use FacebookAds\Object\Traits\CannotDelete; |
| 32 | 32 | use FacebookAds\Object\Traits\FieldValidation; |
| 33 | 33 | |
| 34 | -class AdAccount extends AbstractCrudObject |
|
| 35 | -{ |
|
| 34 | +class AdAccount extends AbstractCrudObject { |
|
| 36 | 35 | use FieldValidation; |
| 37 | 36 | use CannotCreate; |
| 38 | 37 | use CannotDelete; |
@@ -40,16 +39,14 @@ discard block |
||
| 40 | 39 | /** |
| 41 | 40 | * @return string |
| 42 | 41 | */ |
| 43 | - protected function getEndpoint() |
|
| 44 | - { |
|
| 42 | + protected function getEndpoint() { |
|
| 45 | 43 | return 'adaccounts'; |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | 46 | /** |
| 49 | 47 | * @return AdAccountFields |
| 50 | 48 | */ |
| 51 | - public static function getFieldsEnum() |
|
| 52 | - { |
|
| 49 | + public static function getFieldsEnum() { |
|
| 53 | 50 | return AdAccountFields::getInstance(); |
| 54 | 51 | } |
| 55 | 52 | |
@@ -59,8 +56,7 @@ discard block |
||
| 59 | 56 | * @return Cursor |
| 60 | 57 | */ |
| 61 | 58 | public function getActivities( |
| 62 | - array $fields = array(), array $params = array()) |
|
| 63 | - { |
|
| 59 | + array $fields = array(), array $params = array()) { |
|
| 64 | 60 | return $this->getManyByConnection( |
| 65 | 61 | Activity::className(), $fields, $params, 'activities'); |
| 66 | 62 | } |
@@ -70,8 +66,7 @@ discard block |
||
| 70 | 66 | * @param array $params |
| 71 | 67 | * @return Cursor |
| 72 | 68 | */ |
| 73 | - public function getAdUsers(array $fields = array(), array $params = array()) |
|
| 74 | - { |
|
| 69 | + public function getAdUsers(array $fields = array(), array $params = array()) { |
|
| 75 | 70 | return $this->getManyByConnection(AdUser::className(), $fields, $params); |
| 76 | 71 | } |
| 77 | 72 | |
@@ -81,8 +76,7 @@ discard block |
||
| 81 | 76 | * @return Cursor |
| 82 | 77 | */ |
| 83 | 78 | public function getCampaigns( |
| 84 | - array $fields = array(), array $params = array()) |
|
| 85 | - { |
|
| 79 | + array $fields = array(), array $params = array()) { |
|
| 86 | 80 | return $this->getManyByConnection( |
| 87 | 81 | Campaign::className(), $fields, $params); |
| 88 | 82 | } |
@@ -92,8 +86,7 @@ discard block |
||
| 92 | 86 | * @param array $params |
| 93 | 87 | * @return Cursor |
| 94 | 88 | */ |
| 95 | - public function getAdSets(array $fields = array(), array $params = array()) |
|
| 96 | - { |
|
| 89 | + public function getAdSets(array $fields = array(), array $params = array()) { |
|
| 97 | 90 | return $this->getManyByConnection(AdSet::className(), $fields, $params); |
| 98 | 91 | } |
| 99 | 92 | |
@@ -103,8 +96,7 @@ discard block |
||
| 103 | 96 | * @return Cursor |
| 104 | 97 | */ |
| 105 | 98 | public function getAds( |
| 106 | - array $fields = array(), array $params = array()) |
|
| 107 | - { |
|
| 99 | + array $fields = array(), array $params = array()) { |
|
| 108 | 100 | return $this->getManyByConnection(Ad::className(), $fields, $params); |
| 109 | 101 | } |
| 110 | 102 | |
@@ -114,8 +106,7 @@ discard block |
||
| 114 | 106 | * @return Cursor |
| 115 | 107 | */ |
| 116 | 108 | public function getAdCreatives( |
| 117 | - array $fields = array(), array $params = array()) |
|
| 118 | - { |
|
| 109 | + array $fields = array(), array $params = array()) { |
|
| 119 | 110 | return $this->getManyByConnection( |
| 120 | 111 | AdCreative::className(), $fields, $params); |
| 121 | 112 | } |
@@ -126,8 +117,7 @@ discard block |
||
| 126 | 117 | * @return Cursor |
| 127 | 118 | */ |
| 128 | 119 | public function getAdImages( |
| 129 | - array $fields = array(), array $params = array()) |
|
| 130 | - { |
|
| 120 | + array $fields = array(), array $params = array()) { |
|
| 131 | 121 | return $this->getManyByConnection(AdImage::className(), $fields, $params); |
| 132 | 122 | } |
| 133 | 123 | |
@@ -137,8 +127,7 @@ discard block |
||
| 137 | 127 | * @return Cursor |
| 138 | 128 | */ |
| 139 | 129 | public function getAdsPixels( |
| 140 | - array $fields = array(), array $params = array()) |
|
| 141 | - { |
|
| 130 | + array $fields = array(), array $params = array()) { |
|
| 142 | 131 | return $this->getManyByConnection(AdsPixel::className(), $fields, $params); |
| 143 | 132 | } |
| 144 | 133 | |
@@ -148,8 +137,7 @@ discard block |
||
| 148 | 137 | * @return Cursor |
| 149 | 138 | */ |
| 150 | 139 | public function getAdVideos( |
| 151 | - array $fields = array(), array $params = array()) |
|
| 152 | - { |
|
| 140 | + array $fields = array(), array $params = array()) { |
|
| 153 | 141 | return $this->getManyByConnection(AdVideo::className(), $fields, $params); |
| 154 | 142 | } |
| 155 | 143 | |
@@ -159,8 +147,7 @@ discard block |
||
| 159 | 147 | * @return Cursor |
| 160 | 148 | */ |
| 161 | 149 | public function getBroadCategoryTargeting( |
| 162 | - array $fields = array(), array $params = array()) |
|
| 163 | - { |
|
| 150 | + array $fields = array(), array $params = array()) { |
|
| 164 | 151 | return $this->getManyByConnection( |
| 165 | 152 | BroadCategoryTargeting::className(), |
| 166 | 153 | $fields, |
@@ -175,8 +162,7 @@ discard block |
||
| 175 | 162 | * @return Cursor |
| 176 | 163 | */ |
| 177 | 164 | public function getConnectionObjects( |
| 178 | - array $fields = array(), array $params = array()) |
|
| 179 | - { |
|
| 165 | + array $fields = array(), array $params = array()) { |
|
| 180 | 166 | return $this->getManyByConnection( |
| 181 | 167 | ConnectionObject::className(), $fields, $params, 'connectionobjects'); |
| 182 | 168 | } |
@@ -187,8 +173,7 @@ discard block |
||
| 187 | 173 | * @return Cursor |
| 188 | 174 | */ |
| 189 | 175 | public function getCustomAudiences( |
| 190 | - array $fields = array(), array $params = array()) |
|
| 191 | - { |
|
| 176 | + array $fields = array(), array $params = array()) { |
|
| 192 | 177 | return $this->getManyByConnection( |
| 193 | 178 | CustomAudience::className(), $fields, $params); |
| 194 | 179 | } |
@@ -199,8 +184,7 @@ discard block |
||
| 199 | 184 | * @return Cursor |
| 200 | 185 | */ |
| 201 | 186 | public function getConversionPixels( |
| 202 | - array $fields = array(), array $params = array()) |
|
| 203 | - { |
|
| 187 | + array $fields = array(), array $params = array()) { |
|
| 204 | 188 | return $this->getManyByConnection( |
| 205 | 189 | AdConversionPixel::className(), $fields, $params); |
| 206 | 190 | } |
@@ -211,8 +195,7 @@ discard block |
||
| 211 | 195 | * @return Cursor |
| 212 | 196 | */ |
| 213 | 197 | public function getPartnerCategories( |
| 214 | - array $fields = array(), array $params = array()) |
|
| 215 | - { |
|
| 198 | + array $fields = array(), array $params = array()) { |
|
| 216 | 199 | return $this->getManyByConnection( |
| 217 | 200 | PartnerCategory::className(), $fields, $params); |
| 218 | 201 | } |
@@ -223,8 +206,7 @@ discard block |
||
| 223 | 206 | * @return Cursor |
| 224 | 207 | */ |
| 225 | 208 | public function getRateCards( |
| 226 | - array $fields = array(), array $params = array()) |
|
| 227 | - { |
|
| 209 | + array $fields = array(), array $params = array()) { |
|
| 228 | 210 | return $this->getManyByConnection( |
| 229 | 211 | RateCard::className(), $fields, $params, 'ratecard'); |
| 230 | 212 | } |
@@ -235,8 +217,7 @@ discard block |
||
| 235 | 217 | * @return ReachEstimate |
| 236 | 218 | */ |
| 237 | 219 | public function getReachEstimate( |
| 238 | - array $fields = array(), array $params = array()) |
|
| 239 | - { |
|
| 220 | + array $fields = array(), array $params = array()) { |
|
| 240 | 221 | return $this->getOneByConnection( |
| 241 | 222 | ReachEstimate::className(), $fields, $params, 'reachestimate'); |
| 242 | 223 | } |
@@ -247,8 +228,7 @@ discard block |
||
| 247 | 228 | * @return Cursor |
| 248 | 229 | */ |
| 249 | 230 | public function getReachFrequencyPredictions( |
| 250 | - array $fields = array(), array $params = array()) |
|
| 251 | - { |
|
| 231 | + array $fields = array(), array $params = array()) { |
|
| 252 | 232 | return $this->getManyByConnection( |
| 253 | 233 | ReachFrequencyPrediction::className(), $fields, $params); |
| 254 | 234 | } |
@@ -259,8 +239,7 @@ discard block |
||
| 259 | 239 | * @return TargetingDescription |
| 260 | 240 | */ |
| 261 | 241 | public function getTargetingDescription( |
| 262 | - array $fields = array(), array $params = array()) |
|
| 263 | - { |
|
| 242 | + array $fields = array(), array $params = array()) { |
|
| 264 | 243 | return $this->getOneByConnection( |
| 265 | 244 | TargetingDescription::className(), |
| 266 | 245 | $fields, |
@@ -274,8 +253,7 @@ discard block |
||
| 274 | 253 | * @return Cursor |
| 275 | 254 | */ |
| 276 | 255 | public function getTransactions( |
| 277 | - array $fields = array(), array $params = array()) |
|
| 278 | - { |
|
| 256 | + array $fields = array(), array $params = array()) { |
|
| 279 | 257 | return $this->getManyByConnection( |
| 280 | 258 | Transaction::className(), $fields, $params, 'transactions'); |
| 281 | 259 | } |
@@ -286,8 +264,7 @@ discard block |
||
| 286 | 264 | * @return Cursor |
| 287 | 265 | */ |
| 288 | 266 | public function getAdPreviews( |
| 289 | - array $fields = array(), array $params = array()) |
|
| 290 | - { |
|
| 267 | + array $fields = array(), array $params = array()) { |
|
| 291 | 268 | return $this->getManyByConnection( |
| 292 | 269 | AdPreview::classname(), $fields, $params, 'generatepreviews'); |
| 293 | 270 | } |
@@ -298,8 +275,7 @@ discard block |
||
| 298 | 275 | * @return Cursor |
| 299 | 276 | */ |
| 300 | 277 | public function getInsights( |
| 301 | - array $fields = array(), array $params = array()) |
|
| 302 | - { |
|
| 278 | + array $fields = array(), array $params = array()) { |
|
| 303 | 279 | return $this->getManyByConnection( |
| 304 | 280 | Insights::classname(), $fields, $params, 'insights'); |
| 305 | 281 | } |
@@ -310,8 +286,7 @@ discard block |
||
| 310 | 286 | * @return AsyncJobInsights |
| 311 | 287 | */ |
| 312 | 288 | public function getInsightsAsync( |
| 313 | - array $fields = array(), array $params = array()) |
|
| 314 | - { |
|
| 289 | + array $fields = array(), array $params = array()) { |
|
| 315 | 290 | return $this->createAsyncJob( |
| 316 | 291 | AsyncJobInsights::className(), $fields, $params); |
| 317 | 292 | } |
@@ -322,8 +297,7 @@ discard block |
||
| 322 | 297 | * @return Cursor |
| 323 | 298 | */ |
| 324 | 299 | public function getAgencies( |
| 325 | - array $fields = array(), array $params = array()) |
|
| 326 | - { |
|
| 300 | + array $fields = array(), array $params = array()) { |
|
| 327 | 301 | return $this->getManyByConnection( |
| 328 | 302 | Agency::className(), $fields, $params, 'agencies'); |
| 329 | 303 | } |
@@ -332,8 +306,7 @@ discard block |
||
| 332 | 306 | * @param int $business_id |
| 333 | 307 | * @param array $permitted_roles |
| 334 | 308 | */ |
| 335 | - public function grantAgencyAcccess($business_id, $permitted_roles) |
|
| 336 | - { |
|
| 309 | + public function grantAgencyAcccess($business_id, $permitted_roles) { |
|
| 337 | 310 | $params = array( |
| 338 | 311 | 'business' => $business_id, |
| 339 | 312 | 'permitted_roles' => $permitted_roles, |
@@ -348,8 +321,7 @@ discard block |
||
| 348 | 321 | /** |
| 349 | 322 | * @param int $business_id |
| 350 | 323 | */ |
| 351 | - public function revokeAgencyAccess($business_id) |
|
| 352 | - { |
|
| 324 | + public function revokeAgencyAccess($business_id) { |
|
| 353 | 325 | $params = array( |
| 354 | 326 | 'business' => $business_id, |
| 355 | 327 | ); |
@@ -366,8 +338,7 @@ discard block |
||
| 366 | 338 | * @return Cursor |
| 367 | 339 | */ |
| 368 | 340 | public function getMinimumBudgets( |
| 369 | - array $fields = array(), array $params = array()) |
|
| 370 | - { |
|
| 341 | + array $fields = array(), array $params = array()) { |
|
| 371 | 342 | return $this->getManyByConnection( |
| 372 | 343 | MinimumBudget::className(), $fields, $params, 'minimum_budgets'); |
| 373 | 344 | } |
@@ -378,8 +349,7 @@ discard block |
||
| 378 | 349 | * @return Cursor |
| 379 | 350 | */ |
| 380 | 351 | public function getAdPlacePageSets( |
| 381 | - array $fields = array(), array $params = array()) |
|
| 382 | - { |
|
| 352 | + array $fields = array(), array $params = array()) { |
|
| 383 | 353 | return $this->getManyByConnection( |
| 384 | 354 | AdPlacePageSet::className(), $fields, $params); |
| 385 | 355 | } |
@@ -390,8 +360,7 @@ discard block |
||
| 390 | 360 | * @return Cursor |
| 391 | 361 | */ |
| 392 | 362 | public function getAdLabels( |
| 393 | - array $fields = array(), array $params = array()) |
|
| 394 | - { |
|
| 363 | + array $fields = array(), array $params = array()) { |
|
| 395 | 364 | return $this->getManyByConnection( |
| 396 | 365 | AdLabel::className(), $fields, $params); |
| 397 | 366 | } |
@@ -402,8 +371,7 @@ discard block |
||
| 402 | 371 | * @return Cursor |
| 403 | 372 | */ |
| 404 | 373 | public function getCampaignsByLabel( |
| 405 | - array $fields = array(), array $params = array()) |
|
| 406 | - { |
|
| 374 | + array $fields = array(), array $params = array()) { |
|
| 407 | 375 | return $this->getManyByConnection( |
| 408 | 376 | Campaign::classname(), $fields, $params, 'campaignsbylabels'); |
| 409 | 377 | } |
@@ -414,8 +382,7 @@ discard block |
||
| 414 | 382 | * @return Cursor |
| 415 | 383 | */ |
| 416 | 384 | public function getAdSetsByLabel( |
| 417 | - array $fields = array(), array $params = array()) |
|
| 418 | - { |
|
| 385 | + array $fields = array(), array $params = array()) { |
|
| 419 | 386 | return $this->getManyByConnection( |
| 420 | 387 | AdSet::classname(), $fields, $params, 'adsetsbylabels'); |
| 421 | 388 | } |
@@ -426,8 +393,7 @@ discard block |
||
| 426 | 393 | * @return Cursor |
| 427 | 394 | */ |
| 428 | 395 | public function getAdsByLabel( |
| 429 | - array $fields = array(), array $params = array()) |
|
| 430 | - { |
|
| 396 | + array $fields = array(), array $params = array()) { |
|
| 431 | 397 | return $this->getManyByConnection( |
| 432 | 398 | Ad::classname(), $fields, $params, 'adsbylabels'); |
| 433 | 399 | } |
@@ -438,8 +404,7 @@ discard block |
||
| 438 | 404 | * @return Cursor |
| 439 | 405 | */ |
| 440 | 406 | public function getAdCreativesByLabel( |
| 441 | - array $fields = array(), array $params = array()) |
|
| 442 | - { |
|
| 407 | + array $fields = array(), array $params = array()) { |
|
| 443 | 408 | return $this->getManyByConnection( |
| 444 | 409 | AdCreative::classname(), $fields, $params, 'adcreativesbylabels'); |
| 445 | 410 | } |
@@ -450,8 +415,7 @@ discard block |
||
| 450 | 415 | * @return Cursor |
| 451 | 416 | */ |
| 452 | 417 | public function getCustomConversions( |
| 453 | - array $fields = array(), array $params = array()) |
|
| 454 | - { |
|
| 418 | + array $fields = array(), array $params = array()) { |
|
| 455 | 419 | return $this->getManyByConnection( |
| 456 | 420 | CustomConversion::className(), $fields, $params); |
| 457 | 421 | } |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | /** |
| 83 | 83 | * @param array $fields |
| 84 | 84 | * @param array $params |
| 85 | - * @return Cursor |
|
| 85 | + * @return \FacebookAds\Cursor |
|
| 86 | 86 | */ |
| 87 | 87 | public function getVideoThumbnails( |
| 88 | 88 | array $fields = array(), array $params = array()) |
@@ -30,28 +30,24 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Traits\CannotUpdate; |
| 31 | 31 | use FacebookAds\Object\Traits\FieldValidation; |
| 32 | 32 | |
| 33 | -class AdVideo extends AbstractCrudObject |
|
| 34 | -{ |
|
| 33 | +class AdVideo extends AbstractCrudObject { |
|
| 35 | 34 | use FieldValidation; |
| 36 | 35 | |
| 37 | 36 | /** |
| 38 | 37 | * @return string |
| 39 | 38 | */ |
| 40 | - protected function getEndpoint() |
|
| 41 | - { |
|
| 39 | + protected function getEndpoint() { |
|
| 42 | 40 | return 'advideos'; |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | 43 | /** |
| 46 | 44 | * @return AdVideoFields |
| 47 | 45 | */ |
| 48 | - public static function getFieldsEnum() |
|
| 49 | - { |
|
| 46 | + public static function getFieldsEnum() { |
|
| 50 | 47 | return AdVideoFields::getInstance(); |
| 51 | 48 | } |
| 52 | 49 | |
| 53 | - public function create(array $params = array()) |
|
| 54 | - { |
|
| 50 | + public function create(array $params = array()) { |
|
| 55 | 51 | $data = $this->exportData(); |
| 56 | 52 | $source = null; |
| 57 | 53 | if (array_key_exists(AdVideoFields::SOURCE, $data)) { |
@@ -85,8 +81,7 @@ discard block |
||
| 85 | 81 | * @return Cursor |
| 86 | 82 | */ |
| 87 | 83 | public function getVideoThumbnails( |
| 88 | - array $fields = array(), array $params = array()) |
|
| 89 | - { |
|
| 84 | + array $fields = array(), array $params = array()) { |
|
| 90 | 85 | return $this->getManyByConnection( |
| 91 | 86 | VideoThumbnail::className(), $fields, $params, 'thumbnails'); |
| 92 | 87 | } |
@@ -27,8 +27,6 @@ |
||
| 27 | 27 | use FacebookAds\Http\RequestInterface; |
| 28 | 28 | use FacebookAds\Object\CustomAudienceNormalizers\HashNormalizer; |
| 29 | 29 | use FacebookAds\Object\Fields\CustomAudienceFields; |
| 30 | -use FacebookAds\Object\Fields\CustomAudienceMultikeySchemaFields; |
|
| 31 | -use FacebookAds\Object\Values\CustomAudienceTypes; |
|
| 32 | 30 | |
| 33 | 31 | class CustomAudienceMultiKey extends AbstractCrudObject |
| 34 | 32 | { |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
|
| 4 | - * |
|
| 5 | - * You are hereby granted a non-exclusive, worldwide, royalty-free license to |
|
| 6 | - * use, copy, modify, and distribute this software in source code or binary |
|
| 7 | - * form for use in connection with the web services and APIs provided by |
|
| 8 | - * Facebook. |
|
| 9 | - * |
|
| 10 | - * As with any software that integrates with the Facebook platform, your use |
|
| 11 | - * of this software is subject to the Facebook Developer Principles and |
|
| 12 | - * Policies [http://developers.facebook.com/policy/]. This copyright notice |
|
| 13 | - * shall be included in all copies or substantial portions of the software. |
|
| 14 | - * |
|
| 15 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 16 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 17 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
| 18 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 19 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 20 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
| 21 | - * DEALINGS IN THE SOFTWARE. |
|
| 22 | - * |
|
| 23 | - */ |
|
| 3 | + * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. |
|
| 4 | + * |
|
| 5 | + * You are hereby granted a non-exclusive, worldwide, royalty-free license to |
|
| 6 | + * use, copy, modify, and distribute this software in source code or binary |
|
| 7 | + * form for use in connection with the web services and APIs provided by |
|
| 8 | + * Facebook. |
|
| 9 | + * |
|
| 10 | + * As with any software that integrates with the Facebook platform, your use |
|
| 11 | + * of this software is subject to the Facebook Developer Principles and |
|
| 12 | + * Policies [http://developers.facebook.com/policy/]. This copyright notice |
|
| 13 | + * shall be included in all copies or substantial portions of the software. |
|
| 14 | + * |
|
| 15 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 16 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 17 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
| 18 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 19 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
| 20 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
| 21 | + * DEALINGS IN THE SOFTWARE. |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | const HASH_TYPE_SHA256 = 'sha256'; |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * @var \ArrayObject |
|
| 42 | - */ |
|
| 41 | + * @var \ArrayObject |
|
| 42 | + */ |
|
| 43 | 43 | protected $normalizers; |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Fields\CustomAudienceMultikeySchemaFields; |
| 31 | 31 | use FacebookAds\Object\Values\CustomAudienceTypes; |
| 32 | 32 | |
| 33 | -class CustomAudienceMultiKey extends AbstractCrudObject |
|
| 34 | -{ |
|
| 33 | +class CustomAudienceMultiKey extends AbstractCrudObject { |
|
| 35 | 34 | /** |
| 36 | 35 | * @var string |
| 37 | 36 | */ |
@@ -45,24 +44,21 @@ discard block |
||
| 45 | 44 | /** |
| 46 | 45 | * @return string |
| 47 | 46 | */ |
| 48 | - protected function getEndpoint() |
|
| 49 | - { |
|
| 47 | + protected function getEndpoint() { |
|
| 50 | 48 | return 'customaudiences'; |
| 51 | 49 | } |
| 52 | 50 | |
| 53 | 51 | /** |
| 54 | 52 | * @return CustomAudienceFields |
| 55 | 53 | */ |
| 56 | - public static function getFieldsEnum() |
|
| 57 | - { |
|
| 54 | + public static function getFieldsEnum() { |
|
| 58 | 55 | return CustomAudienceFields::getInstance(); |
| 59 | 56 | } |
| 60 | 57 | |
| 61 | 58 | /** |
| 62 | 59 | * @return \ArrayObject |
| 63 | 60 | */ |
| 64 | - public function getNormalizers() |
|
| 65 | - { |
|
| 61 | + public function getNormalizers() { |
|
| 66 | 62 | if ($this->normalizers === null) { |
| 67 | 63 | $this->normalizers = new \ArrayObject(array( |
| 68 | 64 | new CustomAudienceNormalizers\EmailNormalizer(), |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | { |
| 29 | 29 | /** |
| 30 | 30 | * @param string $key |
| 31 | - * @param string $key_value |
|
| 31 | + * @param string $val |
|
| 32 | 32 | * @return boolean |
| 33 | 33 | */ |
| 34 | 34 | public function shouldNormalize($key, $val); |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param string $key |
| 38 | - * @param string $key_value |
|
| 38 | + * @param string $val |
|
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | 41 | public function normalize($key, $val); |
@@ -24,8 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object\CustomAudienceNormalizers; |
| 26 | 26 | |
| 27 | -interface ValueNormalizerInterface |
|
| 28 | -{ |
|
| 27 | +interface ValueNormalizerInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @param string $key |
| 31 | 30 | * @param string $key_value |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * @return CustomConversionFields |
|
| 43 | + * @return Fields\AdConversionPixelFields |
|
| 44 | 44 | */ |
| 45 | 45 | public static function getFieldsEnum() |
| 46 | 46 | { |
@@ -27,23 +27,20 @@ |
||
| 27 | 27 | use FacebookAds\Object\Fields\CustomConversionFields; |
| 28 | 28 | use FacebookAds\Object\Traits\CannotDelete; |
| 29 | 29 | |
| 30 | -class CustomConversion extends AbstractCrudObject |
|
| 31 | -{ |
|
| 30 | +class CustomConversion extends AbstractCrudObject { |
|
| 32 | 31 | use CannotDelete; |
| 33 | 32 | |
| 34 | 33 | /** |
| 35 | 34 | * @return string |
| 36 | 35 | */ |
| 37 | - protected function getEndpoint() |
|
| 38 | - { |
|
| 36 | + protected function getEndpoint() { |
|
| 39 | 37 | return 'customconversions'; |
| 40 | 38 | } |
| 41 | 39 | |
| 42 | 40 | /** |
| 43 | 41 | * @return CustomConversionFields |
| 44 | 42 | */ |
| 45 | - public static function getFieldsEnum() |
|
| 46 | - { |
|
| 43 | + public static function getFieldsEnum() { |
|
| 47 | 44 | return CustomConversionFields::getInstance(); |
| 48 | 45 | } |
| 49 | 46 | } |