@@ -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 | } |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | use FacebookAds\Exception\Exception; |
| 28 | 28 | |
| 29 | -class RequestException extends Exception |
|
| 30 | -{ |
|
| 29 | +class RequestException extends Exception { |
|
| 31 | 30 | /** |
| 32 | 31 | * @var int Status code for the response causing the exception |
| 33 | 32 | */ |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | * @param mixed $default |
| 94 | 93 | * @return mixed |
| 95 | 94 | */ |
| 96 | - protected static function idx(array $array, $key, $default = null) |
|
| 97 | - { |
|
| 95 | + protected static function idx(array $array, $key, $default = null) { |
|
| 98 | 96 | return array_key_exists($key, $array) |
| 99 | 97 | ? $array[$key] |
| 100 | 98 | : $default; |
@@ -104,8 +102,7 @@ discard block |
||
| 104 | 102 | * @param array $response_data |
| 105 | 103 | * @return array |
| 106 | 104 | */ |
| 107 | - protected static function getErrorData(array $response_data) |
|
| 108 | - { |
|
| 105 | + protected static function getErrorData(array $response_data) { |
|
| 109 | 106 | $error_data = static::idx($response_data, 'error', array()); |
| 110 | 107 | |
| 111 | 108 | return array( |
@@ -130,8 +127,7 @@ discard block |
||
| 130 | 127 | * @param int $status_code the HTTP response code |
| 131 | 128 | * @return RequestException |
| 132 | 129 | */ |
| 133 | - public static function create(array $response_data, $status_code) |
|
| 134 | - { |
|
| 130 | + public static function create(array $response_data, $status_code) { |
|
| 135 | 131 | $error_data = static::getErrorData($response_data); |
| 136 | 132 | if (in_array($error_data['error_subcode'], array(458, 459, 460, 463, 464, 467)) |
| 137 | 133 | || in_array($error_data['code'], array(100, 102, 190)) |
@@ -154,40 +150,35 @@ discard block |
||
| 154 | 150 | /** |
| 155 | 151 | * @return int |
| 156 | 152 | */ |
| 157 | - public function getHttpStatusCode() |
|
| 158 | - { |
|
| 153 | + public function getHttpStatusCode() { |
|
| 159 | 154 | return $this->statusCode; |
| 160 | 155 | } |
| 161 | 156 | |
| 162 | 157 | /** |
| 163 | 158 | * @return int|null |
| 164 | 159 | */ |
| 165 | - public function getErrorSubcode() |
|
| 166 | - { |
|
| 160 | + public function getErrorSubcode() { |
|
| 167 | 161 | return $this->errorSubcode; |
| 168 | 162 | } |
| 169 | 163 | |
| 170 | 164 | /** |
| 171 | 165 | * @return string|null |
| 172 | 166 | */ |
| 173 | - public function getErrorUserTitle() |
|
| 174 | - { |
|
| 167 | + public function getErrorUserTitle() { |
|
| 175 | 168 | return $this->errorUserTitle; |
| 176 | 169 | } |
| 177 | 170 | |
| 178 | 171 | /** |
| 179 | 172 | * @return string|null |
| 180 | 173 | */ |
| 181 | - public function getErrorUserMessage() |
|
| 182 | - { |
|
| 174 | + public function getErrorUserMessage() { |
|
| 183 | 175 | return $this->errorUserMessage; |
| 184 | 176 | } |
| 185 | 177 | |
| 186 | 178 | /** |
| 187 | 179 | * @return array|null |
| 188 | 180 | */ |
| 189 | - public function getErrorBlameFieldSpecs() |
|
| 190 | - { |
|
| 181 | + public function getErrorBlameFieldSpecs() { |
|
| 191 | 182 | return $this->errorBlameFieldSpecs; |
| 192 | 183 | } |
| 193 | 184 | } |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class PermissionException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class PermissionException extends RequestException { |
|
| 29 | 28 | } |
@@ -24,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Exception; |
| 26 | 26 | |
| 27 | -class ServerException extends RequestException |
|
| 28 | -{ |
|
| 27 | +class ServerException extends RequestException { |
|
| 29 | 28 | } |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | use FacebookAds\Http\RequestInterface; |
| 29 | 29 | use FacebookAds\Http\ResponseInterface; |
| 30 | 30 | |
| 31 | -interface AdapterInterface |
|
| 32 | -{ |
|
| 31 | +interface AdapterInterface { |
|
| 33 | 32 | /** |
| 34 | 33 | * @param Client $client |
| 35 | 34 | */ |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | use FacebookAds\Http\Client; |
| 28 | 28 | |
| 29 | -abstract class AbstractAdapter implements AdapterInterface |
|
| 30 | -{ |
|
| 29 | +abstract class AbstractAdapter implements AdapterInterface { |
|
| 31 | 30 | /** |
| 32 | 31 | * @var Client |
| 33 | 32 | */ |
@@ -36,24 +35,21 @@ discard block |
||
| 36 | 35 | /** |
| 37 | 36 | * @param Client $client |
| 38 | 37 | */ |
| 39 | - public function __construct(Client $client) |
|
| 40 | - { |
|
| 38 | + public function __construct(Client $client) { |
|
| 41 | 39 | $this->client = $client; |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | 42 | /** |
| 45 | 43 | * @return Client |
| 46 | 44 | */ |
| 47 | - public function getClient() |
|
| 48 | - { |
|
| 45 | + public function getClient() { |
|
| 49 | 46 | return $this->client; |
| 50 | 47 | } |
| 51 | 48 | |
| 52 | 49 | /** |
| 53 | 50 | * @return string |
| 54 | 51 | */ |
| 55 | - public function getCaBundlePath() |
|
| 56 | - { |
|
| 52 | + public function getCaBundlePath() { |
|
| 57 | 53 | return $this->getClient()->getCaBundlePath(); |
| 58 | 54 | } |
| 59 | 55 | } |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | use FacebookAds\Http\RequestInterface; |
| 34 | 34 | use FacebookAds\Http\ResponseInterface; |
| 35 | 35 | |
| 36 | -class CurlAdapter extends AbstractAdapter |
|
| 37 | -{ |
|
| 36 | +class CurlAdapter extends AbstractAdapter { |
|
| 38 | 37 | /** |
| 39 | 38 | * @var CurlInterface |
| 40 | 39 | */ |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | * @param Client $client |
| 50 | 49 | * @param CurlInterface $curl |
| 51 | 50 | */ |
| 52 | - public function __construct(Client $client, CurlInterface $curl = null) |
|
| 53 | - { |
|
| 51 | + public function __construct(Client $client, CurlInterface $curl = null) { |
|
| 54 | 52 | parent::__construct($client); |
| 55 | 53 | $this->curl = $curl ?: AbstractCurl::createOptimalVersion(); |
| 56 | 54 | $this->curl->init(); |
@@ -59,16 +57,14 @@ discard block |
||
| 59 | 57 | /** |
| 60 | 58 | * @return Curl |
| 61 | 59 | */ |
| 62 | - public function getCurl() |
|
| 63 | - { |
|
| 60 | + public function getCurl() { |
|
| 64 | 61 | return $this->curl; |
| 65 | 62 | } |
| 66 | 63 | |
| 67 | 64 | /** |
| 68 | 65 | * @return \ArrayObject |
| 69 | 66 | */ |
| 70 | - public function getOpts() |
|
| 71 | - { |
|
| 67 | + public function getOpts() { |
|
| 72 | 68 | if ($this->opts === null) { |
| 73 | 69 | $this->opts = new \ArrayObject(array( |
| 74 | 70 | CURLOPT_CONNECTTIMEOUT => 10, |
@@ -85,16 +81,14 @@ discard block |
||
| 85 | 81 | /** |
| 86 | 82 | * @param \ArrayObject $opts |
| 87 | 83 | */ |
| 88 | - public function setOpts(\ArrayObject $opts) |
|
| 89 | - { |
|
| 84 | + public function setOpts(\ArrayObject $opts) { |
|
| 90 | 85 | $this->opts = $opts; |
| 91 | 86 | } |
| 92 | 87 | |
| 93 | 88 | /** |
| 94 | 89 | * @return int |
| 95 | 90 | */ |
| 96 | - protected function getheaderSize() |
|
| 97 | - { |
|
| 91 | + protected function getheaderSize() { |
|
| 98 | 92 | return $this->getCurl()->getInfo(CURLINFO_HEADER_SIZE); |
| 99 | 93 | } |
| 100 | 94 | |
@@ -103,8 +97,7 @@ discard block |
||
| 103 | 97 | * @param string $raw_response |
| 104 | 98 | * @return array |
| 105 | 99 | */ |
| 106 | - protected function extractResponseHeadersAndBody($raw_response) |
|
| 107 | - { |
|
| 100 | + protected function extractResponseHeadersAndBody($raw_response) { |
|
| 108 | 101 | $header_size = $this->getheaderSize(); |
| 109 | 102 | |
| 110 | 103 | $raw_headers = mb_substr($raw_response, 0, $header_size); |
@@ -117,8 +110,7 @@ discard block |
||
| 117 | 110 | * @param Headers $headers |
| 118 | 111 | * @param string $raw_headers |
| 119 | 112 | */ |
| 120 | - protected function parseHeaders(Headers $headers, $raw_headers) |
|
| 121 | - { |
|
| 113 | + protected function parseHeaders(Headers $headers, $raw_headers) { |
|
| 122 | 114 | $raw_headers = str_replace("\r\n", "\n", $raw_headers); |
| 123 | 115 | |
| 124 | 116 | // There will be multiple headers if a 301 was followed |
@@ -143,8 +135,7 @@ discard block |
||
| 143 | 135 | * @return ResponseInterface |
| 144 | 136 | * @throws Exception |
| 145 | 137 | */ |
| 146 | - public function sendRequest(RequestInterface $request) |
|
| 147 | - { |
|
| 138 | + public function sendRequest(RequestInterface $request) { |
|
| 148 | 139 | $response = $this->getClient()->createResponse(); |
| 149 | 140 | $this->getCurl()->reset(); |
| 150 | 141 | $curlopts = array( |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Adapter\Curl; |
| 26 | 26 | |
| 27 | -abstract class AbstractCurl implements CurlInterface |
|
| 28 | -{ |
|
| 27 | +abstract class AbstractCurl implements CurlInterface { |
|
| 29 | 28 | /** |
| 30 | 29 | * @var resource |
| 31 | 30 | */ |
@@ -34,28 +33,24 @@ discard block |
||
| 34 | 33 | /** |
| 35 | 34 | * @throws \RuntimeException |
| 36 | 35 | */ |
| 37 | - public function __construct() |
|
| 38 | - { |
|
| 36 | + public function __construct() { |
|
| 39 | 37 | if (!extension_loaded('curl')) { |
| 40 | 38 | throw new \RuntimeException("Extension curl not loaded"); |
| 41 | 39 | } |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - public function __clone() |
|
| 45 | - { |
|
| 42 | + public function __clone() { |
|
| 46 | 43 | $this->handle = curl_copy_handle($this->handle); |
| 47 | 44 | } |
| 48 | 45 | |
| 49 | - public function __destruct() |
|
| 50 | - { |
|
| 46 | + public function __destruct() { |
|
| 51 | 47 | curl_close($this->handle); |
| 52 | 48 | } |
| 53 | 49 | |
| 54 | 50 | /** |
| 55 | 51 | * @return CurlInterface |
| 56 | 52 | */ |
| 57 | - public static function createOptimalVersion() |
|
| 58 | - { |
|
| 53 | + public static function createOptimalVersion() { |
|
| 59 | 54 | if (version_compare(PHP_VERSION, '5.5.0') >= 0) { |
| 60 | 55 | return new Curl55(); |
| 61 | 56 | } else { |
@@ -66,32 +61,28 @@ discard block |
||
| 66 | 61 | /** |
| 67 | 62 | * @return resource |
| 68 | 63 | */ |
| 69 | - public function getHandle() |
|
| 70 | - { |
|
| 64 | + public function getHandle() { |
|
| 71 | 65 | return $this->handle; |
| 72 | 66 | } |
| 73 | 67 | |
| 74 | 68 | /** |
| 75 | 69 | * @return int |
| 76 | 70 | */ |
| 77 | - public function errno() |
|
| 78 | - { |
|
| 71 | + public function errno() { |
|
| 79 | 72 | return curl_errno($this->handle); |
| 80 | 73 | } |
| 81 | 74 | |
| 82 | 75 | /** |
| 83 | 76 | * @return string |
| 84 | 77 | */ |
| 85 | - public function error() |
|
| 86 | - { |
|
| 78 | + public function error() { |
|
| 87 | 79 | return curl_error($this->handle); |
| 88 | 80 | } |
| 89 | 81 | |
| 90 | 82 | /** |
| 91 | 83 | * @return mixed |
| 92 | 84 | */ |
| 93 | - public function exec() |
|
| 94 | - { |
|
| 85 | + public function exec() { |
|
| 95 | 86 | return curl_exec($this->handle); |
| 96 | 87 | } |
| 97 | 88 | |
@@ -99,24 +90,21 @@ discard block |
||
| 99 | 90 | * @param int $opt |
| 100 | 91 | * @return mixed |
| 101 | 92 | */ |
| 102 | - public function getInfo($opt = 0) |
|
| 103 | - { |
|
| 93 | + public function getInfo($opt = 0) { |
|
| 104 | 94 | return curl_getinfo($this->handle, $opt); |
| 105 | 95 | } |
| 106 | 96 | |
| 107 | 97 | /** |
| 108 | 98 | * @return void |
| 109 | 99 | */ |
| 110 | - public function init() |
|
| 111 | - { |
|
| 100 | + public function init() { |
|
| 112 | 101 | $this->handle = $this->handle ?: curl_init(); |
| 113 | 102 | } |
| 114 | 103 | |
| 115 | 104 | /** |
| 116 | 105 | * @param array $opts |
| 117 | 106 | */ |
| 118 | - public function setoptArray(array $opts) |
|
| 119 | - { |
|
| 107 | + public function setoptArray(array $opts) { |
|
| 120 | 108 | curl_setopt_array($this->handle, $opts); |
| 121 | 109 | } |
| 122 | 110 | |
@@ -125,8 +113,7 @@ discard block |
||
| 125 | 113 | * @param mixed $value |
| 126 | 114 | * @return bool |
| 127 | 115 | */ |
| 128 | - public function setopt($option, $value) |
|
| 129 | - { |
|
| 116 | + public function setopt($option, $value) { |
|
| 130 | 117 | return curl_setopt($this->handle, $option, $value); |
| 131 | 118 | } |
| 132 | 119 | |
@@ -134,8 +121,7 @@ discard block |
||
| 134 | 121 | * @param int $age |
| 135 | 122 | * @return array |
| 136 | 123 | */ |
| 137 | - public static function version($age) |
|
| 138 | - { |
|
| 124 | + public static function version($age) { |
|
| 139 | 125 | return curl_version($age); |
| 140 | 126 | } |
| 141 | 127 | } |
@@ -1,26 +1,26 @@ |
||
| 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\Fields; |
| 26 | 26 | |
@@ -24,13 +24,11 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Http\Adapter\Curl; |
| 26 | 26 | |
| 27 | -class Curl extends AbstractCurl |
|
| 28 | -{ |
|
| 27 | +class Curl extends AbstractCurl { |
|
| 29 | 28 | /** |
| 30 | 29 | * @throws \RuntimeException |
| 31 | 30 | */ |
| 32 | - public function __construct() |
|
| 33 | - { |
|
| 31 | + public function __construct() { |
|
| 34 | 32 | parent::__construct(); |
| 35 | 33 | if (version_compare(PHP_VERSION, '5.5.0') >= 0) { |
| 36 | 34 | throw new \RuntimeException("Unsupported Curl version"); |
@@ -41,8 +39,7 @@ discard block |
||
| 41 | 39 | * @param string $string |
| 42 | 40 | * @return string |
| 43 | 41 | */ |
| 44 | - public function escape($string) |
|
| 45 | - { |
|
| 42 | + public function escape($string) { |
|
| 46 | 43 | return rawurlencode($string); |
| 47 | 44 | } |
| 48 | 45 | |
@@ -50,8 +47,7 @@ discard block |
||
| 50 | 47 | * @param int $bitmask |
| 51 | 48 | * @return int |
| 52 | 49 | */ |
| 53 | - public function pause($bitmask) |
|
| 54 | - { |
|
| 50 | + public function pause($bitmask) { |
|
| 55 | 51 | return 0; |
| 56 | 52 | } |
| 57 | 53 | |
@@ -59,16 +55,14 @@ discard block |
||
| 59 | 55 | * @param string $filepath |
| 60 | 56 | * @return string |
| 61 | 57 | */ |
| 62 | - public function preparePostFileField($filepath) |
|
| 63 | - { |
|
| 58 | + public function preparePostFileField($filepath) { |
|
| 64 | 59 | return "@".$filepath; |
| 65 | 60 | } |
| 66 | 61 | |
| 67 | 62 | /** |
| 68 | 63 | * @return void |
| 69 | 64 | */ |
| 70 | - public function reset() |
|
| 71 | - { |
|
| 65 | + public function reset() { |
|
| 72 | 66 | $this->handle && curl_close($this->handle); |
| 73 | 67 | $this->handle = curl_init(); |
| 74 | 68 | } |
@@ -77,8 +71,7 @@ discard block |
||
| 77 | 71 | * @param int $errornum |
| 78 | 72 | * @return NULL|string |
| 79 | 73 | */ |
| 80 | - public static function strerror($errornum) |
|
| 81 | - { |
|
| 74 | + public static function strerror($errornum) { |
|
| 82 | 75 | return curl_strerror($errornum); |
| 83 | 76 | } |
| 84 | 77 | |
@@ -86,8 +79,7 @@ discard block |
||
| 86 | 79 | * @param string $string |
| 87 | 80 | * @return bool|string |
| 88 | 81 | */ |
| 89 | - public function unescape($string) |
|
| 90 | - { |
|
| 82 | + public function unescape($string) { |
|
| 91 | 83 | return curl_unescape($this->handle, $string); |
| 92 | 84 | } |
| 93 | 85 | } |