@@ -25,7 +25,6 @@ |
||
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
| 27 | 27 | use FacebookAds\Api; |
| 28 | -use FacebookAds\Cursor; |
|
| 29 | 28 | use FacebookAds\Http\RequestInterface; |
| 30 | 29 | use FacebookAds\Object\Fields\AdImageFields; |
| 31 | 30 | use FacebookAds\Object\Traits\CannotUpdate; |
@@ -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 | |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | use FacebookAds\Object\Traits\CannotUpdate; |
| 32 | 32 | use FacebookAds\Object\Traits\FieldValidation; |
| 33 | 33 | |
| 34 | -class AdImage extends AbstractCrudObject |
|
| 35 | -{ |
|
| 34 | +class AdImage extends AbstractCrudObject { |
|
| 36 | 35 | use FieldValidation; |
| 37 | 36 | use CannotUpdate; |
| 38 | 37 | |
@@ -59,24 +58,21 @@ discard block |
||
| 59 | 58 | /** |
| 60 | 59 | * @return string |
| 61 | 60 | */ |
| 62 | - protected function getEndpoint() |
|
| 63 | - { |
|
| 61 | + protected function getEndpoint() { |
|
| 64 | 62 | return 'adimages'; |
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | /** |
| 68 | 66 | * @return AdImageFields |
| 69 | 67 | */ |
| 70 | - public static function getFieldsEnum() |
|
| 71 | - { |
|
| 68 | + public static function getFieldsEnum() { |
|
| 72 | 69 | return AdImageFields::getInstance(); |
| 73 | 70 | } |
| 74 | 71 | |
| 75 | 72 | /** |
| 76 | 73 | * @return string |
| 77 | 74 | */ |
| 78 | - protected function getNodePath() |
|
| 79 | - { |
|
| 75 | + protected function getNodePath() { |
|
| 80 | 76 | return '/'.$this->assureParentId().'/'.$this->getEndpoint(); |
| 81 | 77 | } |
| 82 | 78 | |
@@ -88,8 +84,7 @@ discard block |
||
| 88 | 84 | * @throws \Exception |
| 89 | 85 | * @throws \RuntimeException |
| 90 | 86 | */ |
| 91 | - public function create(array $params = array()) |
|
| 92 | - { |
|
| 87 | + public function create(array $params = array()) { |
|
| 93 | 88 | if ($this->data[static::FIELD_ID]) { |
| 94 | 89 | throw new \Exception("Object has already an ID"); |
| 95 | 90 | } |
@@ -131,8 +126,7 @@ discard block |
||
| 131 | 126 | * @param array $params Additional request parameters |
| 132 | 127 | * @return $this |
| 133 | 128 | */ |
| 134 | - public function read(array $fields = array(), array $params = array()) |
|
| 135 | - { |
|
| 129 | + public function read(array $fields = array(), array $params = array()) { |
|
| 136 | 130 | $fields = implode(',', $fields ?: static::getDefaultReadFields()); |
| 137 | 131 | if ($fields) { |
| 138 | 132 | $params['fields'] = $fields; |
@@ -162,8 +156,7 @@ discard block |
||
| 162 | 156 | * @return void |
| 163 | 157 | * @throws \Exception |
| 164 | 158 | */ |
| 165 | - public function delete(array $params = array()) |
|
| 166 | - { |
|
| 159 | + public function delete(array $params = array()) { |
|
| 167 | 160 | if (!$this->data[AdImageFields::HASH]) { |
| 168 | 161 | throw new \Exception("AdImage hash is required to delete"); |
| 169 | 162 | } |
@@ -181,8 +174,7 @@ discard block |
||
| 181 | 174 | * @return array |
| 182 | 175 | * @throws \RuntimeException |
| 183 | 176 | */ |
| 184 | - protected function arrayFromZip($params = array()) |
|
| 185 | - { |
|
| 177 | + protected function arrayFromZip($params = array()) { |
|
| 186 | 178 | if (!$this->isZipFile($this->data[AdImageFields::FILENAME])) { |
| 187 | 179 | throw new \RuntimeException($this->data[AdImageFields::FILENAME]." doesn't resolve to a zip file"); |
| 188 | 180 | } |
@@ -223,8 +215,7 @@ discard block |
||
| 223 | 215 | * @param string $file_path |
| 224 | 216 | * @return bool |
| 225 | 217 | */ |
| 226 | - protected function isZipFile($file_path) |
|
| 227 | - { |
|
| 218 | + protected function isZipFile($file_path) { |
|
| 228 | 219 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 229 | 220 | $file_mime_type = finfo_file($finfo, $file_path); |
| 230 | 221 | return $file_mime_type == 'application/zip' || |
@@ -26,8 +26,6 @@ |
||
| 26 | 26 | |
| 27 | 27 | use FacebookAds\Http\RequestInterface; |
| 28 | 28 | use FacebookAds\Object\Fields\AdVideoFields; |
| 29 | -use FacebookAds\Object\Traits\CannotDelete; |
|
| 30 | -use FacebookAds\Object\Traits\CannotUpdate; |
|
| 31 | 29 | use FacebookAds\Object\Traits\FieldValidation; |
| 32 | 30 | |
| 33 | 31 | class AdVideo extends AbstractCrudObject { |
@@ -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()) |
@@ -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 | |
@@ -30,28 +30,24 @@ |
||
| 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)) { |
@@ -24,7 +24,6 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
| 27 | -use FacebookAds\Api; |
|
| 28 | 27 | use FacebookAds\Object\Fields\ProductCatalogFields; |
| 29 | 28 | use FacebookAds\Object\Traits\FieldValidation; |
| 30 | 29 | use FacebookAds\Http\RequestInterface; |
@@ -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 | |
@@ -30,23 +30,20 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Fields\ProductCatalogFields; |
| 31 | 31 | use FacebookAds\Object\Traits\FieldValidation; |
| 32 | 32 | |
| 33 | -class ProductCatalog extends AbstractCrudObject |
|
| 34 | -{ |
|
| 33 | +class ProductCatalog 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 'product_catalogs'; |
| 43 | 41 | } |
| 44 | 42 | |
| 45 | 43 | /** |
| 46 | 44 | * @return ProductCatalogFields |
| 47 | 45 | */ |
| 48 | - public static function getFieldsEnum() |
|
| 49 | - { |
|
| 46 | + public static function getFieldsEnum() { |
|
| 50 | 47 | return ProductCatalogFields::getInstance(); |
| 51 | 48 | } |
| 52 | 49 | |
@@ -89,8 +86,7 @@ discard block |
||
| 89 | 86 | /** |
| 90 | 87 | * @return array |
| 91 | 88 | */ |
| 92 | - public function getExternalEventSources() |
|
| 93 | - { |
|
| 89 | + public function getExternalEventSources() { |
|
| 94 | 90 | $response = $this->getApi()->call( |
| 95 | 91 | '/'.$this->assureId().'/external_event_sources', |
| 96 | 92 | RequestInterface::METHOD_GET |
@@ -103,8 +99,7 @@ discard block |
||
| 103 | 99 | * @param array $pixel_ids |
| 104 | 100 | * @return bool |
| 105 | 101 | */ |
| 106 | - public function setExternalEventSources(array $pixel_ids) |
|
| 107 | - { |
|
| 102 | + public function setExternalEventSources(array $pixel_ids) { |
|
| 108 | 103 | return $this->modifyExternalEventSources( |
| 109 | 104 | RequestInterface::METHOD_POST, |
| 110 | 105 | $pixel_ids |
@@ -115,8 +110,7 @@ discard block |
||
| 115 | 110 | * @param array $pixel_ids |
| 116 | 111 | * @return bool |
| 117 | 112 | */ |
| 118 | - public function removeExternalEventSources(array $pixel_ids) |
|
| 119 | - { |
|
| 113 | + public function removeExternalEventSources(array $pixel_ids) { |
|
| 120 | 114 | return $this->modifyExternalEventSources( |
| 121 | 115 | RequestInterface::METHOD_DELETE, |
| 122 | 116 | $pixel_ids |
@@ -128,8 +122,7 @@ discard block |
||
| 128 | 122 | * @param array $pixel_ids |
| 129 | 123 | * @return bool |
| 130 | 124 | */ |
| 131 | - protected function modifyExternalEventSources($method, array $pixel_ids) |
|
| 132 | - { |
|
| 125 | + protected function modifyExternalEventSources($method, array $pixel_ids) { |
|
| 133 | 126 | $params = array( |
| 134 | 127 | ProductCatalogFields::EXTERNAL_EVENT_SOURCES => $pixel_ids, |
| 135 | 128 | ); |
@@ -147,8 +140,7 @@ discard block |
||
| 147 | 140 | * @param int $user_id |
| 148 | 141 | * @param string $role |
| 149 | 142 | */ |
| 150 | - public function addUserPermission($user_id, $role) |
|
| 151 | - { |
|
| 143 | + public function addUserPermission($user_id, $role) { |
|
| 152 | 144 | $params = array( |
| 153 | 145 | 'user' => $user_id, |
| 154 | 146 | 'role' => $role, |
@@ -163,8 +155,7 @@ discard block |
||
| 163 | 155 | /** |
| 164 | 156 | * @param int $user_id |
| 165 | 157 | */ |
| 166 | - public function deleteUserPermission($user_id) |
|
| 167 | - { |
|
| 158 | + public function deleteUserPermission($user_id) { |
|
| 168 | 159 | $params = array( |
| 169 | 160 | 'user' => $user_id, |
| 170 | 161 | ); |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
| 27 | 27 | use FacebookAds\Object\Fields\ProductFeedUploadFields; |
| 28 | -use FacebookAds\Object\Traits\CannotCreate; |
|
| 29 | 28 | use FacebookAds\Object\Traits\CannotDelete; |
| 30 | 29 | use FacebookAds\Object\Traits\CannotUpdate; |
| 31 | 30 | use FacebookAds\Cursor; |
@@ -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 | |
@@ -30,24 +30,21 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Traits\CannotDelete; |
| 31 | 31 | use FacebookAds\Object\Traits\CannotUpdate; |
| 32 | 32 | |
| 33 | -class ProductFeedUpload extends AbstractCrudObject |
|
| 34 | -{ |
|
| 33 | +class ProductFeedUpload extends AbstractCrudObject { |
|
| 35 | 34 | use CannotDelete; |
| 36 | 35 | use CannotUpdate; |
| 37 | 36 | |
| 38 | 37 | /** |
| 39 | 38 | * @return string |
| 40 | 39 | */ |
| 41 | - protected function getEndpoint() |
|
| 42 | - { |
|
| 40 | + protected function getEndpoint() { |
|
| 43 | 41 | return 'uploads'; |
| 44 | 42 | } |
| 45 | 43 | |
| 46 | 44 | /** |
| 47 | 45 | * @return ProductFeedUploadFields |
| 48 | 46 | */ |
| 49 | - public static function getFieldsEnum() |
|
| 50 | - { |
|
| 47 | + public static function getFieldsEnum() { |
|
| 51 | 48 | return ProductFeedUploadFields::getInstance(); |
| 52 | 49 | } |
| 53 | 50 | |
@@ -56,8 +53,7 @@ discard block |
||
| 56 | 53 | * @param array $params |
| 57 | 54 | * @return Cursor |
| 58 | 55 | */ |
| 59 | - public function getErrors(array $fields = array(), array $params = array()) |
|
| 60 | - { |
|
| 56 | + public function getErrors(array $fields = array(), array $params = array()) { |
|
| 61 | 57 | return $this->getManyByConnection( |
| 62 | 58 | ProductFeedUploadError::className(), $fields, $params); |
| 63 | 59 | } |
@@ -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 | |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * @method static AdAccountFields getInstance() |
| 31 | 31 | */ |
| 32 | -class AdAccountFields extends AbstractEnum |
|
| 33 | -{ |
|
| 32 | +class AdAccountFields extends AbstractEnum { |
|
| 34 | 33 | const ACCOUNT_GROUPS = 'account_groups'; |
| 35 | 34 | const ACCOUNT_ID = 'account_id'; |
| 36 | 35 | const ACCOUNT_STATUS = 'account_status'; |
@@ -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 | |
@@ -27,15 +27,13 @@ discard block |
||
| 27 | 27 | use FacebookAds\Http\RequestInterface; |
| 28 | 28 | use FacebookAds\Http\ResponseInterface; |
| 29 | 29 | |
| 30 | -class NullLogger implements LoggerInterface |
|
| 31 | -{ |
|
| 30 | +class NullLogger implements LoggerInterface { |
|
| 32 | 31 | /** |
| 33 | 32 | * @param string $level |
| 34 | 33 | * @param string $message |
| 35 | 34 | * @param array $context |
| 36 | 35 | */ |
| 37 | - public function log($level, $message, array $context = array()) |
|
| 38 | - { |
|
| 36 | + public function log($level, $message, array $context = array()) { |
|
| 39 | 37 | } |
| 40 | 38 | |
| 41 | 39 | /** |
@@ -43,8 +41,7 @@ discard block |
||
| 43 | 41 | * @param RequestInterface $request |
| 44 | 42 | * @param array $context |
| 45 | 43 | */ |
| 46 | - public function logRequest($level, RequestInterface $request, array $context = array()) |
|
| 47 | - { |
|
| 44 | + public function logRequest($level, RequestInterface $request, array $context = array()) { |
|
| 48 | 45 | } |
| 49 | 46 | |
| 50 | 47 | /** |
@@ -52,7 +49,6 @@ discard block |
||
| 52 | 49 | * @param ResponseInterface $response |
| 53 | 50 | * @param array $context |
| 54 | 51 | */ |
| 55 | - public function logResponse($level, ResponseInterface $response, array $context = array()) |
|
| 56 | - { |
|
| 52 | + public function logResponse($level, ResponseInterface $response, array $context = array()) { |
|
| 57 | 53 | } |
| 58 | 54 | } |
@@ -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 | |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | use FacebookAds\Http\RequestInterface; |
| 30 | 30 | use FacebookAds\Http\ResponseInterface; |
| 31 | 31 | |
| 32 | -abstract class AbstractCrudObject extends AbstractObject |
|
| 33 | -{ |
|
| 32 | +abstract class AbstractCrudObject extends AbstractObject { |
|
| 34 | 33 | /** |
| 35 | 34 | * @var string |
| 36 | 35 | */ |
@@ -61,8 +60,7 @@ discard block |
||
| 61 | 60 | * @param string $parent_id Optional, needed for creating new objects. |
| 62 | 61 | * @param Api $api The Api instance this object should use to make calls |
| 63 | 62 | */ |
| 64 | - public function __construct($id = null, $parent_id = null, Api $api = null) |
|
| 65 | - { |
|
| 63 | + public function __construct($id = null, $parent_id = null, Api $api = null) { |
|
| 66 | 64 | parent::__construct(); |
| 67 | 65 | $this->data[static::FIELD_ID] = $id; |
| 68 | 66 | $this->parentId = $parent_id; |
@@ -72,24 +70,21 @@ discard block |
||
| 72 | 70 | /** |
| 73 | 71 | * @param string $id |
| 74 | 72 | */ |
| 75 | - public function setId($id) |
|
| 76 | - { |
|
| 73 | + public function setId($id) { |
|
| 77 | 74 | $this->data[static::FIELD_ID] = $id; |
| 78 | 75 | } |
| 79 | 76 | |
| 80 | 77 | /** |
| 81 | 78 | * @param string $parent_id |
| 82 | 79 | */ |
| 83 | - public function setParentId($parent_id) |
|
| 84 | - { |
|
| 80 | + public function setParentId($parent_id) { |
|
| 85 | 81 | $this->parentId = $parent_id; |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | 84 | /** |
| 89 | 85 | * @param Api $api The Api instance this object should use to make calls |
| 90 | 86 | */ |
| 91 | - public function setApi(Api $api) |
|
| 92 | - { |
|
| 87 | + public function setApi(Api $api) { |
|
| 93 | 88 | $this->api = static::assureApi($api); |
| 94 | 89 | } |
| 95 | 90 | |
@@ -103,8 +98,7 @@ discard block |
||
| 103 | 98 | * @return Api |
| 104 | 99 | * @throws \InvalidArgumentException |
| 105 | 100 | */ |
| 106 | - protected static function assureApi(Api $instance = null) |
|
| 107 | - { |
|
| 101 | + protected static function assureApi(Api $instance = null) { |
|
| 108 | 102 | $instance = $instance ?: Api::instance(); |
| 109 | 103 | if (!$instance) { |
| 110 | 104 | throw new \InvalidArgumentException( |
@@ -118,8 +112,7 @@ discard block |
||
| 118 | 112 | /** |
| 119 | 113 | * @return string|null |
| 120 | 114 | */ |
| 121 | - public function getParentId() |
|
| 122 | - { |
|
| 115 | + public function getParentId() { |
|
| 123 | 116 | return $this->parentId; |
| 124 | 117 | } |
| 125 | 118 | |
@@ -127,8 +120,7 @@ discard block |
||
| 127 | 120 | * @return string |
| 128 | 121 | * @throws \Exception |
| 129 | 122 | */ |
| 130 | - protected function assureParentId() |
|
| 131 | - { |
|
| 123 | + protected function assureParentId() { |
|
| 132 | 124 | if (!$this->parentId) { |
| 133 | 125 | throw new \Exception("A parent ID is required."); |
| 134 | 126 | } |
@@ -140,8 +132,7 @@ discard block |
||
| 140 | 132 | * @return string |
| 141 | 133 | * @throws \Exception |
| 142 | 134 | */ |
| 143 | - protected function assureId() |
|
| 144 | - { |
|
| 135 | + protected function assureId() { |
|
| 145 | 136 | if (!$this->data[static::FIELD_ID]) { |
| 146 | 137 | throw new \Exception("field '".static::FIELD_ID."' is required."); |
| 147 | 138 | } |
@@ -152,8 +143,7 @@ discard block |
||
| 152 | 143 | /** |
| 153 | 144 | * @return Api |
| 154 | 145 | */ |
| 155 | - public function getApi() |
|
| 156 | - { |
|
| 146 | + public function getApi() { |
|
| 157 | 147 | return $this->api; |
| 158 | 148 | } |
| 159 | 149 | |
@@ -162,8 +152,7 @@ discard block |
||
| 162 | 152 | * |
| 163 | 153 | * @return array Key value pairs of changed variables |
| 164 | 154 | */ |
| 165 | - public function getChangedValues() |
|
| 166 | - { |
|
| 155 | + public function getChangedValues() { |
|
| 167 | 156 | return $this->changedFields; |
| 168 | 157 | } |
| 169 | 158 | |
@@ -172,16 +161,14 @@ discard block |
||
| 172 | 161 | * |
| 173 | 162 | * @return array Array of changed field names |
| 174 | 163 | */ |
| 175 | - public function getChangedFields() |
|
| 176 | - { |
|
| 164 | + public function getChangedFields() { |
|
| 177 | 165 | return array_keys($this->changedFields); |
| 178 | 166 | } |
| 179 | 167 | |
| 180 | 168 | /** |
| 181 | 169 | * Get the values which have changed, converting them to scalars |
| 182 | 170 | */ |
| 183 | - public function exportData() |
|
| 184 | - { |
|
| 171 | + public function exportData() { |
|
| 185 | 172 | $data = array(); |
| 186 | 173 | foreach ($this->changedFields as $key => $val) { |
| 187 | 174 | $data[$key] = $val instanceof AbstractObject ? $val->exportData() : $val; |
@@ -193,8 +180,7 @@ discard block |
||
| 193 | 180 | /** |
| 194 | 181 | * @return void |
| 195 | 182 | */ |
| 196 | - protected function clearHistory() |
|
| 197 | - { |
|
| 183 | + protected function clearHistory() { |
|
| 198 | 184 | $this->changedFields = array(); |
| 199 | 185 | } |
| 200 | 186 | |
@@ -202,8 +188,7 @@ discard block |
||
| 202 | 188 | * @param string $name |
| 203 | 189 | * @param mixed $value |
| 204 | 190 | */ |
| 205 | - public function __set($name, $value) |
|
| 206 | - { |
|
| 191 | + public function __set($name, $value) { |
|
| 207 | 192 | if (!array_key_exists($name, $this->data) |
| 208 | 193 | || $this->data[$name] !== $value) { |
| 209 | 194 | $this->changedFields[$name] = $value; |
@@ -214,24 +199,21 @@ discard block |
||
| 214 | 199 | /** |
| 215 | 200 | * @param string[] $fields |
| 216 | 201 | */ |
| 217 | - public static function setDefaultReadFields(array $fields = array()) |
|
| 218 | - { |
|
| 202 | + public static function setDefaultReadFields(array $fields = array()) { |
|
| 219 | 203 | static::$defaultReadFields = $fields; |
| 220 | 204 | } |
| 221 | 205 | |
| 222 | 206 | /** |
| 223 | 207 | * @return string[] |
| 224 | 208 | */ |
| 225 | - public static function getDefaultReadFields() |
|
| 226 | - { |
|
| 209 | + public static function getDefaultReadFields() { |
|
| 227 | 210 | return static::$defaultReadFields; |
| 228 | 211 | } |
| 229 | 212 | |
| 230 | 213 | /** |
| 231 | 214 | * @return string |
| 232 | 215 | */ |
| 233 | - protected function getNodePath() |
|
| 234 | - { |
|
| 216 | + protected function getNodePath() { |
|
| 235 | 217 | return '/'.$this->assureId(); |
| 236 | 218 | } |
| 237 | 219 | |
@@ -242,8 +224,7 @@ discard block |
||
| 242 | 224 | * @return $this |
| 243 | 225 | * @throws \Exception |
| 244 | 226 | */ |
| 245 | - public function create(array $params = array()) |
|
| 246 | - { |
|
| 227 | + public function create(array $params = array()) { |
|
| 247 | 228 | if ($this->data[static::FIELD_ID]) { |
| 248 | 229 | throw new \Exception("Object has already an ID"); |
| 249 | 230 | } |
@@ -283,8 +264,7 @@ discard block |
||
| 283 | 264 | * @param array $params Additional request parameters |
| 284 | 265 | * @return $this |
| 285 | 266 | */ |
| 286 | - public function read(array $fields = array(), array $params = array()) |
|
| 287 | - { |
|
| 267 | + public function read(array $fields = array(), array $params = array()) { |
|
| 288 | 268 | $fields = implode(',', $fields ?: static::getDefaultReadFields()); |
| 289 | 269 | if ($fields) { |
| 290 | 270 | $params['fields'] = $fields; |
@@ -308,8 +288,7 @@ discard block |
||
| 308 | 288 | * @param array $params Update parameters in assoc |
| 309 | 289 | * @return $this |
| 310 | 290 | */ |
| 311 | - public function update(array $params = array()) |
|
| 312 | - { |
|
| 291 | + public function update(array $params = array()) { |
|
| 313 | 292 | $this->getApi()->call( |
| 314 | 293 | $this->getNodePath(), |
| 315 | 294 | RequestInterface::METHOD_POST, |
@@ -327,8 +306,7 @@ discard block |
||
| 327 | 306 | * @param array $params |
| 328 | 307 | * @return void |
| 329 | 308 | */ |
| 330 | - public function delete(array $params = array()) |
|
| 331 | - { |
|
| 309 | + public function delete(array $params = array()) { |
|
| 332 | 310 | $this->getApi()->call( |
| 333 | 311 | $this->getNodePath(), |
| 334 | 312 | RequestInterface::METHOD_DELETE, |
@@ -345,8 +323,7 @@ discard block |
||
| 345 | 323 | * @param array $params |
| 346 | 324 | * @return $this |
| 347 | 325 | */ |
| 348 | - public function save(array $params = array()) |
|
| 349 | - { |
|
| 326 | + public function save(array $params = array()) { |
|
| 350 | 327 | if ($this->data[static::FIELD_ID]) { |
| 351 | 328 | return $this->update($params); |
| 352 | 329 | } else { |
@@ -360,8 +337,7 @@ discard block |
||
| 360 | 337 | * @return string |
| 361 | 338 | * @throws \InvalidArgumentException |
| 362 | 339 | */ |
| 363 | - protected function assureEndpoint($prototype_class, $endpoint) |
|
| 364 | - { |
|
| 340 | + protected function assureEndpoint($prototype_class, $endpoint) { |
|
| 365 | 341 | if (!$endpoint) { |
| 366 | 342 | $prototype = new $prototype_class(null, null, $this->getApi()); |
| 367 | 343 | if (!$prototype instanceof AbstractCrudObject) { |
@@ -486,8 +462,7 @@ discard block |
||
| 486 | 462 | * @param Api $api Api Object to use |
| 487 | 463 | * @return bool Returns true on success |
| 488 | 464 | */ |
| 489 | - public static function deleteIds(array $ids, Api $api = null) |
|
| 490 | - { |
|
| 465 | + public static function deleteIds(array $ids, Api $api = null) { |
|
| 491 | 466 | $batch = array(); |
| 492 | 467 | foreach ($ids as $id) { |
| 493 | 468 | $request = 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,6 +24,5 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object; |
| 26 | 26 | |
| 27 | -class BusinessAdAccount extends AbstractObject |
|
| 28 | -{ |
|
| 27 | +class BusinessAdAccount extends AbstractObject { |
|
| 29 | 28 | } |
@@ -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\Logger\CurlLogger; |
| 26 | 26 | |
| 27 | -final class JsonNode |
|
| 28 | -{ |
|
| 27 | +final class JsonNode { |
|
| 29 | 28 | /** |
| 30 | 29 | * @var int |
| 31 | 30 | */ |
@@ -51,8 +50,7 @@ discard block |
||
| 51 | 50 | * @return $this |
| 52 | 51 | * @throws \InvalidArgumentException |
| 53 | 52 | */ |
| 54 | - public static function factory($value) |
|
| 55 | - { |
|
| 53 | + public static function factory($value) { |
|
| 56 | 54 | $object = new self(); |
| 57 | 55 | switch (true) { |
| 58 | 56 | case is_object($value): |
@@ -73,16 +71,14 @@ discard block |
||
| 73 | 71 | return $object; |
| 74 | 72 | } |
| 75 | 73 | |
| 76 | - public function __construct() |
|
| 77 | - { |
|
| 74 | + public function __construct() { |
|
| 78 | 75 | $this->children = new \ArrayObject(); |
| 79 | 76 | } |
| 80 | 77 | |
| 81 | 78 | /** |
| 82 | 79 | * @return mixed |
| 83 | 80 | */ |
| 84 | - public function getValue() |
|
| 85 | - { |
|
| 81 | + public function getValue() { |
|
| 86 | 82 | return $this->value; |
| 87 | 83 | } |
| 88 | 84 | |
@@ -90,8 +86,7 @@ discard block |
||
| 90 | 86 | * @param mixed $value |
| 91 | 87 | * @return $this |
| 92 | 88 | */ |
| 93 | - public function setValue($value) |
|
| 94 | - { |
|
| 89 | + public function setValue($value) { |
|
| 95 | 90 | $this->value = $value; |
| 96 | 91 | |
| 97 | 92 | return $this; |
@@ -100,16 +95,14 @@ discard block |
||
| 100 | 95 | /** |
| 101 | 96 | * @return \ArrayObject |
| 102 | 97 | */ |
| 103 | - public function getChildren() |
|
| 104 | - { |
|
| 98 | + public function getChildren() { |
|
| 105 | 99 | return $this->children; |
| 106 | 100 | } |
| 107 | 101 | |
| 108 | 102 | /** |
| 109 | 103 | * @return int |
| 110 | 104 | */ |
| 111 | - public function getMaxTreeChildrenCount() |
|
| 112 | - { |
|
| 105 | + public function getMaxTreeChildrenCount() { |
|
| 113 | 106 | $max = $this->getChildren()->count(); |
| 114 | 107 | |
| 115 | 108 | /** @var JsonNode $child */ |
@@ -125,16 +118,14 @@ discard block |
||
| 125 | 118 | * @param int $indent |
| 126 | 119 | * @return string |
| 127 | 120 | */ |
| 128 | - protected function getPadding($indent) |
|
| 129 | - { |
|
| 121 | + protected function getPadding($indent) { |
|
| 130 | 122 | return str_repeat(' ', $indent * self::INDENT_UNIT); |
| 131 | 123 | } |
| 132 | 124 | |
| 133 | 125 | /** |
| 134 | 126 | * @return mixed |
| 135 | 127 | */ |
| 136 | - protected function getLastChildKey() |
|
| 137 | - { |
|
| 128 | + protected function getLastChildKey() { |
|
| 138 | 129 | if ($this->getChildren()->count() === 0) { |
| 139 | 130 | return null; |
| 140 | 131 | } |
@@ -149,8 +140,7 @@ discard block |
||
| 149 | 140 | * @param int $indent |
| 150 | 141 | * @return string |
| 151 | 142 | */ |
| 152 | - protected function encodeList($indent) |
|
| 153 | - { |
|
| 143 | + protected function encodeList($indent) { |
|
| 154 | 144 | $value = $this->getValue(); |
| 155 | 145 | if (empty($value) || (array_keys($value) === range(0, count($value) - 1))) { |
| 156 | 146 | $is_map = false; |
@@ -184,8 +174,7 @@ discard block |
||
| 184 | 174 | * @param int $indent |
| 185 | 175 | * @return string |
| 186 | 176 | */ |
| 187 | - public function encode($indent = 0) |
|
| 188 | - { |
|
| 177 | + public function encode($indent = 0) { |
|
| 189 | 178 | $value = $this->getValue(); |
| 190 | 179 | if (is_array($value) || is_object($value)) { |
| 191 | 180 | if ($this->getMaxTreeChildrenCount() > 2) { |