@@ -24,10 +24,8 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object\Traits; |
| 26 | 26 | |
| 27 | -trait CannotCreate |
|
| 28 | -{ |
|
| 29 | - public function create(array $params = array()) |
|
| 30 | - { |
|
| 27 | +trait CannotCreate { |
|
| 28 | + public function create(array $params = array()) { |
|
| 31 | 29 | throw new \Exception( |
| 32 | 30 | __CLASS__.' does not have '.__FUNCTION__.' function.' |
| 33 | 31 | ); |
@@ -24,10 +24,8 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object\Traits; |
| 26 | 26 | |
| 27 | -trait CannotUpdate |
|
| 28 | -{ |
|
| 29 | - public function update(array $params = array()) |
|
| 30 | - { |
|
| 27 | +trait CannotUpdate { |
|
| 28 | + public function update(array $params = array()) { |
|
| 31 | 29 | throw new \Exception( |
| 32 | 30 | __CLASS__.' does not have '.__FUNCTION__.' function.' |
| 33 | 31 | ); |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @property array $changedFields |
| 29 | 29 | */ |
| 30 | -trait ObjectValidation |
|
| 31 | -{ |
|
| 30 | +trait ObjectValidation { |
|
| 32 | 31 | /** |
| 33 | 32 | * @param array $params |
| 34 | 33 | * @return $this |
@@ -40,8 +39,7 @@ discard block |
||
| 40 | 39 | * @return $this |
| 41 | 40 | * @throws \InvalidArgumentException |
| 42 | 41 | */ |
| 43 | - public function validate(array $params = array()) |
|
| 44 | - { |
|
| 42 | + public function validate(array $params = array()) { |
|
| 45 | 43 | $changed_fields = $this->changedFields; |
| 46 | 44 | $validate_flag = array( |
| 47 | 45 | 'execution_options' => array('validate_only') |
@@ -31,15 +31,13 @@ discard block |
||
| 31 | 31 | * @method Api getApi() |
| 32 | 32 | * @method string assureId() |
| 33 | 33 | */ |
| 34 | -trait AdLabelAwareCrudObjectTrait |
|
| 35 | -{ |
|
| 34 | +trait AdLabelAwareCrudObjectTrait { |
|
| 36 | 35 | /** |
| 37 | 36 | * Take ad label ids and format them correctly for the request |
| 38 | 37 | * @param array $adlabel_ids |
| 39 | 38 | * @return array |
| 40 | 39 | */ |
| 41 | - protected function formatParams(array $adlabel_ids) |
|
| 42 | - { |
|
| 40 | + protected function formatParams(array $adlabel_ids) { |
|
| 43 | 41 | foreach ($adlabel_ids as &$adlabel_id) { |
| 44 | 42 | $adlabel_id = array('id' => $adlabel_id); |
| 45 | 43 | } |
@@ -50,8 +48,7 @@ discard block |
||
| 50 | 48 | /** |
| 51 | 49 | * @param array $ad_label_ids |
| 52 | 50 | */ |
| 53 | - public function addAdLabels(array $ad_label_ids) |
|
| 54 | - { |
|
| 51 | + public function addAdLabels(array $ad_label_ids) { |
|
| 55 | 52 | $this->getApi()->call( |
| 56 | 53 | '/'.$this->assureId().'/adlabels', |
| 57 | 54 | RequestInterface::METHOD_POST, |
@@ -62,8 +59,7 @@ discard block |
||
| 62 | 59 | /** |
| 63 | 60 | * @param array $ad_label_ids |
| 64 | 61 | */ |
| 65 | - public function removeAdLabels(array $ad_label_ids) |
|
| 66 | - { |
|
| 62 | + public function removeAdLabels(array $ad_label_ids) { |
|
| 67 | 63 | $this->getApi()->call( |
| 68 | 64 | '/'.$this->assureId().'/adlabels', |
| 69 | 65 | RequestInterface::METHOD_DELETE, |
@@ -24,10 +24,8 @@ |
||
| 24 | 24 | |
| 25 | 25 | namespace FacebookAds\Object\Traits; |
| 26 | 26 | |
| 27 | -trait CannotDelete |
|
| 28 | -{ |
|
| 29 | - public function delete(array $params = array()) |
|
| 30 | - { |
|
| 27 | +trait CannotDelete { |
|
| 28 | + public function delete(array $params = array()) { |
|
| 31 | 29 | throw new \Exception( |
| 32 | 30 | __CLASS__.' does not have '.__FUNCTION__.' function.' |
| 33 | 31 | ); |
@@ -29,16 +29,14 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * @method static EnumInstanceInterface getFieldsEnum() |
| 31 | 31 | */ |
| 32 | -trait FieldValidation |
|
| 33 | -{ |
|
| 32 | +trait FieldValidation { |
|
| 34 | 33 | /** |
| 35 | 34 | * @param string $name |
| 36 | 35 | * @param mixed $value |
| 37 | 36 | * @throws \InvalidArgumentException |
| 38 | 37 | * @staticvar array $fields |
| 39 | 38 | */ |
| 40 | - public function __set($name, $value) |
|
| 41 | - { |
|
| 39 | + public function __set($name, $value) { |
|
| 42 | 40 | if (static::getFieldsEnum()->isValidValue($name)) { |
| 43 | 41 | parent::__set($name, $value); |
| 44 | 42 | } else { |
@@ -30,8 +30,7 @@ discard block |
||
| 30 | 30 | use FacebookAds\Object\Traits\CannotUpdate; |
| 31 | 31 | use FacebookAds\Object\Traits\FieldValidation; |
| 32 | 32 | |
| 33 | -class PartnerCategory extends AbstractCrudObject |
|
| 34 | -{ |
|
| 33 | +class PartnerCategory extends AbstractCrudObject { |
|
| 35 | 34 | use CannotCreate; |
| 36 | 35 | use CannotDelete; |
| 37 | 36 | use CannotUpdate; |
@@ -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 'partnercategories'; |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | 46 | /** |
| 49 | 47 | * @return PartnerCategoryFields |
| 50 | 48 | */ |
| 51 | - public static function getFieldsEnum() |
|
| 52 | - { |
|
| 49 | + public static function getFieldsEnum() { |
|
| 53 | 50 | return PartnerCategoryFields::getInstance(); |
| 54 | 51 | } |
| 55 | 52 | } |
@@ -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 | } |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | use FacebookAds\Object\Traits\CannotUpdate; |
| 32 | 32 | use FacebookAds\Object\Traits\FieldValidation; |
| 33 | 33 | |
| 34 | -class AdUser extends AbstractCrudObject |
|
| 35 | -{ |
|
| 34 | +class AdUser extends AbstractCrudObject { |
|
| 36 | 35 | use FieldValidation; |
| 37 | 36 | use CannotDelete; |
| 38 | 37 | use CannotCreate; |
@@ -41,16 +40,14 @@ discard block |
||
| 41 | 40 | /** |
| 42 | 41 | * @return string |
| 43 | 42 | */ |
| 44 | - protected function getEndpoint() |
|
| 45 | - { |
|
| 43 | + protected function getEndpoint() { |
|
| 46 | 44 | return 'users'; |
| 47 | 45 | } |
| 48 | 46 | |
| 49 | 47 | /** |
| 50 | 48 | * @return AdUserFields |
| 51 | 49 | */ |
| 52 | - public static function getFieldsEnum() |
|
| 53 | - { |
|
| 50 | + public static function getFieldsEnum() { |
|
| 54 | 51 | return AdUserFields::getInstance(); |
| 55 | 52 | } |
| 56 | 53 | |
@@ -60,8 +57,7 @@ discard block |
||
| 60 | 57 | * @return Cursor |
| 61 | 58 | */ |
| 62 | 59 | public function getAdAccounts( |
| 63 | - array $fields = array(), array $params = array()) |
|
| 64 | - { |
|
| 60 | + array $fields = array(), array $params = array()) { |
|
| 65 | 61 | return $this->getManyByConnection(AdAccount::className(), $fields, $params); |
| 66 | 62 | } |
| 67 | 63 | |
@@ -71,8 +67,7 @@ discard block |
||
| 71 | 67 | * @return Cursor |
| 72 | 68 | */ |
| 73 | 69 | public function getAdAccountGroups( |
| 74 | - array $fields = array(), array $params = array()) |
|
| 75 | - { |
|
| 70 | + array $fields = array(), array $params = array()) { |
|
| 76 | 71 | return $this->getManyByConnection( |
| 77 | 72 | AdAccountGroup::className(), |
| 78 | 73 | $fields, |