@@ -27,13 +27,11 @@ discard block |
||
27 | 27 | use FacebookAds\Cursor; |
28 | 28 | use FacebookAds\Http\RequestInterface; |
29 | 29 | |
30 | -class Page extends AbstractCrudObject |
|
31 | -{ |
|
30 | +class Page extends AbstractCrudObject { |
|
32 | 31 | /** |
33 | 32 | * @return string |
34 | 33 | */ |
35 | - public function getEndpoint() |
|
36 | - { |
|
34 | + public function getEndpoint() { |
|
37 | 35 | return 'pages'; |
38 | 36 | } |
39 | 37 | |
@@ -66,8 +64,7 @@ discard block |
||
66 | 64 | * @param int $user_id |
67 | 65 | * @param string $role |
68 | 66 | */ |
69 | - public function addUser($business_id, $user_id, $role) |
|
70 | - { |
|
67 | + public function addUser($business_id, $user_id, $role) { |
|
71 | 68 | $params = array( |
72 | 69 | 'business_id' => $business_id, |
73 | 70 | 'user_id' => $user_id, |
@@ -85,8 +82,7 @@ discard block |
||
85 | 82 | * @param int $business_id |
86 | 83 | * @param int $user_id |
87 | 84 | */ |
88 | - public function deleteUser($business_id, $user_id) |
|
89 | - { |
|
85 | + public function deleteUser($business_id, $user_id) { |
|
90 | 86 | $params = array( |
91 | 87 | 'business_id' => $business_id, |
92 | 88 | 'user_id' => $user_id, |
@@ -103,8 +99,7 @@ discard block |
||
103 | 99 | * @param int $business_id |
104 | 100 | * @param array $roles |
105 | 101 | */ |
106 | - public function grantBusinessAccess($business_id, $roles) |
|
107 | - { |
|
102 | + public function grantBusinessAccess($business_id, $roles) { |
|
108 | 103 | $params = array( |
109 | 104 | 'business' => $business_id, |
110 | 105 | 'permitted_roles' => $roles, |
@@ -120,8 +115,7 @@ discard block |
||
120 | 115 | /** |
121 | 116 | * @param int $business_id |
122 | 117 | */ |
123 | - public function revokeBusinessAccess($business_id) |
|
124 | - { |
|
118 | + public function revokeBusinessAccess($business_id) { |
|
125 | 119 | $params = array( |
126 | 120 | 'business' => $business_id, |
127 | 121 | ); |
@@ -26,13 +26,11 @@ |
||
26 | 26 | |
27 | 27 | use FacebookAds\Object\Fields\AdsPixelStatFields; |
28 | 28 | |
29 | -class AdsPixelStat extends AbstractObject |
|
30 | -{ |
|
29 | +class AdsPixelStat extends AbstractObject { |
|
31 | 30 | /** |
32 | 31 | * @return AdsPixelStatFields |
33 | 32 | */ |
34 | - public static function getFieldsEnum() |
|
35 | - { |
|
33 | + public static function getFieldsEnum() { |
|
36 | 34 | return AdsPixelStatFields::getInstance(); |
37 | 35 | } |
38 | 36 | } |
@@ -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 | |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * @return array |
47 | 46 | */ |
48 | 47 | public static function createFromZip( |
49 | - $file_path, $account_id, array $params = array(), Api $api = null) |
|
50 | - { |
|
48 | + $file_path, $account_id, array $params = array(), Api $api = null) { |
|
51 | 49 | $image = new AdImage(null, $account_id, $api); |
52 | 50 | $image->{AdImageFields::FILENAME} = $file_path; |
53 | 51 | return $image->arrayFromZip($params); |
@@ -56,24 +54,21 @@ discard block |
||
56 | 54 | /** |
57 | 55 | * @return string |
58 | 56 | */ |
59 | - protected function getEndpoint() |
|
60 | - { |
|
57 | + protected function getEndpoint() { |
|
61 | 58 | return 'adimages'; |
62 | 59 | } |
63 | 60 | |
64 | 61 | /** |
65 | 62 | * @return AdImageFields |
66 | 63 | */ |
67 | - public static function getFieldsEnum() |
|
68 | - { |
|
64 | + public static function getFieldsEnum() { |
|
69 | 65 | return AdImageFields::getInstance(); |
70 | 66 | } |
71 | 67 | |
72 | 68 | /** |
73 | 69 | * @return string |
74 | 70 | */ |
75 | - protected function getNodePath() |
|
76 | - { |
|
71 | + protected function getNodePath() { |
|
77 | 72 | return '/'.$this->assureParentId().'/'.$this->getEndpoint(); |
78 | 73 | } |
79 | 74 | |
@@ -85,8 +80,7 @@ discard block |
||
85 | 80 | * @throws \Exception |
86 | 81 | * @throws \RuntimeException |
87 | 82 | */ |
88 | - public function create(array $params = array()) |
|
89 | - { |
|
83 | + public function create(array $params = array()) { |
|
90 | 84 | if ($this->data[static::FIELD_ID]) { |
91 | 85 | throw new \Exception("Object has already an ID"); |
92 | 86 | } |
@@ -129,8 +123,7 @@ discard block |
||
129 | 123 | * @param array $params Additional request parameters |
130 | 124 | * @return $this |
131 | 125 | */ |
132 | - public function read(array $fields = array(), array $params = array()) |
|
133 | - { |
|
126 | + public function read(array $fields = array(), array $params = array()) { |
|
134 | 127 | $fields = implode(',', $fields ?: static::getDefaultReadFields()); |
135 | 128 | if ($fields) { |
136 | 129 | $params['fields'] = $fields; |
@@ -159,8 +152,7 @@ discard block |
||
159 | 152 | * @return void |
160 | 153 | * @throws \Exception |
161 | 154 | */ |
162 | - public function delete(array $params = array()) |
|
163 | - { |
|
155 | + public function delete(array $params = array()) { |
|
164 | 156 | if (!$this->data[AdImageFields::HASH]) { |
165 | 157 | throw new \Exception("AdImage hash is required to delete"); |
166 | 158 | } |
@@ -178,8 +170,7 @@ discard block |
||
178 | 170 | * @return array |
179 | 171 | * @throws \RuntimeException |
180 | 172 | */ |
181 | - protected function arrayFromZip($params = array()) |
|
182 | - { |
|
173 | + protected function arrayFromZip($params = array()) { |
|
183 | 174 | if (!$this->isZipFile($this->data[AdImageFields::FILENAME])) { |
184 | 175 | throw new \RuntimeException( |
185 | 176 | $this->data[AdImageFields::FILENAME]." doesn't resolve to a zip file"); |
@@ -220,8 +211,7 @@ discard block |
||
220 | 211 | * @param string $file_path |
221 | 212 | * @return bool |
222 | 213 | */ |
223 | - protected function isZipFile($file_path) |
|
224 | - { |
|
214 | + protected function isZipFile($file_path) { |
|
225 | 215 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
226 | 216 | $file_mime_type = finfo_file($finfo, $file_path); |
227 | 217 | return $file_mime_type == 'application/zip' || |
@@ -24,6 +24,5 @@ |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Object; |
26 | 26 | |
27 | -class Agency extends AbstractObject |
|
28 | -{ |
|
27 | +class Agency extends AbstractObject { |
|
29 | 28 | } |
@@ -24,6 +24,5 @@ |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Object; |
26 | 26 | |
27 | -class Transaction extends AbstractObject |
|
28 | -{ |
|
27 | +class Transaction extends AbstractObject { |
|
29 | 28 | } |
@@ -28,15 +28,13 @@ discard block |
||
28 | 28 | use FacebookAds\Object\CustomAudienceNormalizers\ValueNormalizerInterface; |
29 | 29 | use FacebookAds\Object\Fields\CustomAudienceMultikeySchemaFields; |
30 | 30 | |
31 | -class FirstNameNormalizer implements ValueNormalizerInterface |
|
32 | -{ |
|
31 | +class FirstNameNormalizer implements ValueNormalizerInterface { |
|
33 | 32 | /** |
34 | 33 | * @param string $key |
35 | 34 | * @param string $key_value |
36 | 35 | * @return boolean |
37 | 36 | */ |
38 | - public function shouldNormalize($key, $key_value) |
|
39 | - { |
|
37 | + public function shouldNormalize($key, $key_value) { |
|
40 | 38 | return $key === CustomAudienceMultikeySchemaFields::FIRST_NAME; |
41 | 39 | } |
42 | 40 | |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * @param string $key_value |
46 | 44 | * @return string |
47 | 45 | */ |
48 | - public function normalize($key, $key_value) |
|
49 | - { |
|
46 | + public function normalize($key, $key_value) { |
|
50 | 47 | return preg_replace('/[^a-zA-Z]/', '', strtolower(trim($key_value))); |
51 | 48 | } |
52 | 49 | } |
@@ -28,15 +28,13 @@ discard block |
||
28 | 28 | use FacebookAds\Object\CustomAudienceNormalizers\ValueNormalizerInterface; |
29 | 29 | use FacebookAds\Object\Fields\CustomAudienceMultikeySchemaFields; |
30 | 30 | |
31 | -class BirthYearNormalizer implements ValueNormalizerInterface |
|
32 | -{ |
|
31 | +class BirthYearNormalizer implements ValueNormalizerInterface { |
|
33 | 32 | /** |
34 | 33 | * @param string $key |
35 | 34 | * @param string $key_value |
36 | 35 | * @return boolean |
37 | 36 | */ |
38 | - public function shouldNormalize($key, $key_value) |
|
39 | - { |
|
37 | + public function shouldNormalize($key, $key_value) { |
|
40 | 38 | return $key === CustomAudienceMultikeySchemaFields::BIRTH_YEAR; |
41 | 39 | } |
42 | 40 | |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * @param string $key_value |
46 | 44 | * @return string |
47 | 45 | */ |
48 | - public function normalize($key, $key_value) |
|
49 | - { |
|
46 | + public function normalize($key, $key_value) { |
|
50 | 47 | return preg_replace('/[^0-9]/', '', $key_value); |
51 | 48 | } |
52 | 49 | } |
@@ -28,15 +28,13 @@ discard block |
||
28 | 28 | use FacebookAds\Object\CustomAudienceNormalizers\ValueNormalizerInterface; |
29 | 29 | use FacebookAds\Object\Fields\CustomAudienceMultikeySchemaFields; |
30 | 30 | |
31 | -class PhoneNormalizer implements ValueNormalizerInterface |
|
32 | -{ |
|
31 | +class PhoneNormalizer implements ValueNormalizerInterface { |
|
33 | 32 | /** |
34 | 33 | * @param string $key |
35 | 34 | * @param string $key_value |
36 | 35 | * @return boolean |
37 | 36 | */ |
38 | - public function shouldNormalize($key, $key_value) |
|
39 | - { |
|
37 | + public function shouldNormalize($key, $key_value) { |
|
40 | 38 | return $key === CustomAudienceMultikeySchemaFields::PHONE; |
41 | 39 | } |
42 | 40 | |
@@ -45,8 +43,7 @@ discard block |
||
45 | 43 | * @param string $key_value |
46 | 44 | * @return string |
47 | 45 | */ |
48 | - public function normalize($key, $key_value) |
|
49 | - { |
|
46 | + public function normalize($key, $key_value) { |
|
50 | 47 | return preg_replace('/[^0-9]/', '', trim($key_value)); |
51 | 48 | } |
52 | 49 | } |
@@ -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 |