@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | use FacebookAds\Http\RequestInterface; |
28 | 28 | |
29 | -abstract class AbstractArchivableCrudObject extends AbstractCrudObject |
|
30 | -{ |
|
29 | +abstract class AbstractArchivableCrudObject extends AbstractCrudObject { |
|
31 | 30 | /** |
32 | 31 | * @var string |
33 | 32 | */ |
@@ -56,8 +55,7 @@ discard block |
||
56 | 55 | /** |
57 | 56 | * @return string |
58 | 57 | */ |
59 | - public function getStatusParamName() |
|
60 | - { |
|
58 | + public function getStatusParamName() { |
|
61 | 59 | return self::STATUS_PARAM_NAME; |
62 | 60 | } |
63 | 61 | |
@@ -67,8 +65,7 @@ discard block |
||
67 | 65 | * @param array $params |
68 | 66 | * @return void |
69 | 67 | */ |
70 | - public function archive(array $params = array()) |
|
71 | - { |
|
68 | + public function archive(array $params = array()) { |
|
72 | 69 | $this->getApi()->call( |
73 | 70 | $this->getNodePath(), |
74 | 71 | RequestInterface::METHOD_POST, |
@@ -84,8 +81,7 @@ discard block |
||
84 | 81 | * @param array $params |
85 | 82 | * @return void |
86 | 83 | */ |
87 | - public function delete(array $params = array()) |
|
88 | - { |
|
84 | + public function delete(array $params = array()) { |
|
89 | 85 | $this->getApi()->call( |
90 | 86 | $this->getNodePath(), |
91 | 87 | RequestInterface::METHOD_POST, |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | use FacebookAds\Object\Fields\CustomAudienceFields; |
31 | 31 | use FacebookAds\Object\Values\CustomAudienceTypes; |
32 | 32 | |
33 | -class CustomAudience extends AbstractCrudObject |
|
34 | -{ |
|
33 | +class CustomAudience extends AbstractCrudObject { |
|
35 | 34 | /** |
36 | 35 | * @var string |
37 | 36 | * @deprecated use HashNormalizer::HASH_TYPE_SHA256 |
@@ -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 'customaudiences'; |
47 | 45 | } |
48 | 46 | |
49 | 47 | /** |
50 | 48 | * @return CustomAudienceFields |
51 | 49 | */ |
52 | - public static function getFieldsEnum() |
|
53 | - { |
|
50 | + public static function getFieldsEnum() { |
|
54 | 51 | return CustomAudienceFields::getInstance(); |
55 | 52 | } |
56 | 53 | |
@@ -182,8 +179,7 @@ discard block |
||
182 | 179 | * @param array $act_ids Array of account IDs |
183 | 180 | * @return boolean Returns true on success |
184 | 181 | */ |
185 | - public function addSharedAccounts($act_ids) |
|
186 | - { |
|
182 | + public function addSharedAccounts($act_ids) { |
|
187 | 183 | return $this->getApi()->call( |
188 | 184 | '/'.$this->assureId().'/adaccounts', |
189 | 185 | RequestInterface::METHOD_POST, |
@@ -197,8 +193,7 @@ discard block |
||
197 | 193 | * @param array $act_ids Array of Account IDs to remove |
198 | 194 | * @return boolean Returns true on success |
199 | 195 | */ |
200 | - public function removeSharedAccounts($act_ids) |
|
201 | - { |
|
196 | + public function removeSharedAccounts($act_ids) { |
|
202 | 197 | return $this->getApi()->call( |
203 | 198 | '/'.$this->assureId().'/adaccounts', |
204 | 199 | RequestInterface::METHOD_DELETE, |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | use FacebookAds\Object\Fields\AdAccountGroupUserFields; |
30 | 30 | use FacebookAds\Object\Traits\FieldValidation; |
31 | 31 | |
32 | -class AdAccountGroupUser extends AbstractObject |
|
33 | -{ |
|
32 | +class AdAccountGroupUser extends AbstractObject { |
|
34 | 33 | use FieldValidation; |
35 | 34 | |
36 | 35 | /** |
@@ -62,8 +61,7 @@ discard block |
||
62 | 61 | * @param string $ad_account_group_id |
63 | 62 | * @param Api $api |
64 | 63 | */ |
65 | - public function __construct($ad_account_group_id, Api $api = null) |
|
66 | - { |
|
64 | + public function __construct($ad_account_group_id, Api $api = null) { |
|
67 | 65 | $this->adAccountGroupId = $ad_account_group_id; |
68 | 66 | $this->api = $api; |
69 | 67 | } |
@@ -71,24 +69,21 @@ discard block |
||
71 | 69 | /** |
72 | 70 | * @return AdAccountGroupUserFields |
73 | 71 | */ |
74 | - public static function getFieldsEnum() |
|
75 | - { |
|
72 | + public static function getFieldsEnum() { |
|
76 | 73 | return AdAccountGroupUserFields::getInstance(); |
77 | 74 | } |
78 | 75 | |
79 | 76 | /** |
80 | 77 | * @return Api |
81 | 78 | */ |
82 | - public function getApi() |
|
83 | - { |
|
79 | + public function getApi() { |
|
84 | 80 | return $this->api; |
85 | 81 | } |
86 | 82 | |
87 | 83 | /** |
88 | 84 | * @return string |
89 | 85 | */ |
90 | - public function getParentId() |
|
91 | - { |
|
86 | + public function getParentId() { |
|
92 | 87 | return $this->adAccountGroupId; |
93 | 88 | } |
94 | 89 | |
@@ -96,8 +91,7 @@ discard block |
||
96 | 91 | * @param array $params |
97 | 92 | * @return $this |
98 | 93 | */ |
99 | - public function create(array $params = array()) |
|
100 | - { |
|
94 | + public function create(array $params = array()) { |
|
101 | 95 | return $this->save($params); |
102 | 96 | } |
103 | 97 | |
@@ -105,8 +99,7 @@ discard block |
||
105 | 99 | * @param array $params |
106 | 100 | * @return $this |
107 | 101 | */ |
108 | - public function update(array $params = array()) |
|
109 | - { |
|
102 | + public function update(array $params = array()) { |
|
110 | 103 | return $this->save($params); |
111 | 104 | } |
112 | 105 | |
@@ -114,8 +107,7 @@ discard block |
||
114 | 107 | * @return string |
115 | 108 | * @throws \Exception |
116 | 109 | */ |
117 | - protected function assureId() |
|
118 | - { |
|
110 | + protected function assureId() { |
|
119 | 111 | if (!$this->data[AdAccountGroupUserFields::UID]) { |
120 | 112 | throw new \Exception(AdAccountGroupUserFields::UID.' field must be set'); |
121 | 113 | } |
@@ -127,8 +119,7 @@ discard block |
||
127 | 119 | * @param array $params |
128 | 120 | * @return $this |
129 | 121 | */ |
130 | - public function save(array $params = array()) |
|
131 | - { |
|
122 | + public function save(array $params = array()) { |
|
132 | 123 | $this->assureId(); |
133 | 124 | |
134 | 125 | $this->getApi()->call( |
@@ -143,8 +134,7 @@ discard block |
||
143 | 134 | * @param array $params |
144 | 135 | * @throws \Exception |
145 | 136 | */ |
146 | - public function delete(array $params = array()) |
|
147 | - { |
|
137 | + public function delete(array $params = array()) { |
|
148 | 138 | if (!$this->data[AdAccountGroupUserFields::UID]) { |
149 | 139 | throw new \Exception("UID field must be set"); |
150 | 140 | } |
@@ -160,8 +150,7 @@ discard block |
||
160 | 150 | /** |
161 | 151 | * @return AdUser |
162 | 152 | */ |
163 | - public function getAdUser() |
|
164 | - { |
|
153 | + public function getAdUser() { |
|
165 | 154 | return new AdUser($this->{AdAccountGroupUserFields::UID}); |
166 | 155 | } |
167 | 156 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Enum; |
26 | 26 | |
27 | -abstract class AbstractEnum implements EnumInstanceInterface |
|
28 | -{ |
|
27 | +abstract class AbstractEnum implements EnumInstanceInterface { |
|
29 | 28 | /** |
30 | 29 | * @var array|null |
31 | 30 | */ |
@@ -54,16 +53,14 @@ discard block |
||
54 | 53 | /** |
55 | 54 | * @return string |
56 | 55 | */ |
57 | - public static function className() |
|
58 | - { |
|
56 | + public static function className() { |
|
59 | 57 | return get_called_class(); |
60 | 58 | } |
61 | 59 | |
62 | 60 | /** |
63 | 61 | * @return AbstractEnum |
64 | 62 | */ |
65 | - public static function getInstance() |
|
66 | - { |
|
63 | + public static function getInstance() { |
|
67 | 64 | $fqn = get_called_class(); |
68 | 65 | if (!array_key_exists($fqn, static::$instances)) { |
69 | 66 | static::$instances[$fqn] = new static(); |
@@ -75,8 +72,7 @@ discard block |
||
75 | 72 | /** |
76 | 73 | * @return array |
77 | 74 | */ |
78 | - public function getArrayCopy() |
|
79 | - { |
|
75 | + public function getArrayCopy() { |
|
80 | 76 | if ($this->map === null) { |
81 | 77 | $this->map = (new \ReflectionClass(get_called_class())) |
82 | 78 | ->getConstants(); |
@@ -88,8 +84,7 @@ discard block |
||
88 | 84 | /** |
89 | 85 | * @return array |
90 | 86 | */ |
91 | - public function getNames() |
|
92 | - { |
|
87 | + public function getNames() { |
|
93 | 88 | if ($this->names === null) { |
94 | 89 | $this->names = array_keys($this->getArrayCopy()); |
95 | 90 | } |
@@ -100,8 +95,7 @@ discard block |
||
100 | 95 | /** |
101 | 96 | * @return array |
102 | 97 | */ |
103 | - public function getValues() |
|
104 | - { |
|
98 | + public function getValues() { |
|
105 | 99 | if ($this->values === null) { |
106 | 100 | $this->values = array_values($this->getArrayCopy()); |
107 | 101 | } |
@@ -112,8 +106,7 @@ discard block |
||
112 | 106 | /** |
113 | 107 | * @return array |
114 | 108 | */ |
115 | - public function getValuesMap() |
|
116 | - { |
|
109 | + public function getValuesMap() { |
|
117 | 110 | if ($this->valuesMap === null) { |
118 | 111 | $this->valuesMap = array_fill_keys($this->getValues(), null); |
119 | 112 | } |
@@ -125,8 +118,7 @@ discard block |
||
125 | 118 | * @param string|int|float $name |
126 | 119 | * @return mixed |
127 | 120 | */ |
128 | - public function getValueForName($name) |
|
129 | - { |
|
121 | + public function getValueForName($name) { |
|
130 | 122 | return array_key_exists($name, $this->getArrayCopy()) |
131 | 123 | ? $this->getArrayCopy()[$name] |
132 | 124 | : null; |
@@ -137,8 +129,7 @@ discard block |
||
137 | 129 | * @return mixed |
138 | 130 | * @throws \InvalidArgumentException |
139 | 131 | */ |
140 | - public function assureValueForName($name) |
|
141 | - { |
|
132 | + public function assureValueForName($name) { |
|
142 | 133 | $value = $this->getValueForName($name); |
143 | 134 | if ($value === null) { |
144 | 135 | throw new \InvalidArgumentException('Unknown name "'.$name.'" in '.static::className()); |
@@ -151,8 +142,7 @@ discard block |
||
151 | 142 | * @param string|int|float $name |
152 | 143 | * @return bool |
153 | 144 | */ |
154 | - public function isValid($name) |
|
155 | - { |
|
145 | + public function isValid($name) { |
|
156 | 146 | return array_key_exists($name, $this->getArrayCopy()); |
157 | 147 | } |
158 | 148 | |
@@ -160,8 +150,7 @@ discard block |
||
160 | 150 | * @param string|int|float $name |
161 | 151 | * @throws \InvalidArgumentException |
162 | 152 | */ |
163 | - public function assureIsValid($name) |
|
164 | - { |
|
153 | + public function assureIsValid($name) { |
|
165 | 154 | if (!array_key_exists($name, $this->getArrayCopy())) { |
166 | 155 | throw new \InvalidArgumentException('Unknown name "'.$name.'" in '.static::className()); |
167 | 156 | } |
@@ -171,8 +160,7 @@ discard block |
||
171 | 160 | * @param string|int|float $value |
172 | 161 | * @return bool |
173 | 162 | */ |
174 | - public function isValidValue($value) |
|
175 | - { |
|
163 | + public function isValidValue($value) { |
|
176 | 164 | return array_key_exists($value, $this->getValuesMap()); |
177 | 165 | } |
178 | 166 | |
@@ -180,8 +168,7 @@ discard block |
||
180 | 168 | * @param mixed $value |
181 | 169 | * @throws \InvalidArgumentException |
182 | 170 | */ |
183 | - public function assureIsValidValue($value) |
|
184 | - { |
|
171 | + public function assureIsValidValue($value) { |
|
185 | 172 | if (!$this->isValidValue($value)) { |
186 | 173 | throw new \InvalidArgumentException('"'.$value.'", not a valid value in '.static::className()); |
187 | 174 | } |
@@ -24,8 +24,7 @@ |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Enum; |
26 | 26 | |
27 | -interface EnumInstanceInterface |
|
28 | -{ |
|
27 | +interface EnumInstanceInterface { |
|
29 | 28 | /** |
30 | 29 | * @return EnumInstanceInterface |
31 | 30 | */ |
@@ -24,37 +24,32 @@ |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Enum; |
26 | 26 | |
27 | -class EmptyEnum extends AbstractEnum |
|
28 | -{ |
|
27 | +class EmptyEnum extends AbstractEnum { |
|
29 | 28 | /** |
30 | 29 | * @return array |
31 | 30 | */ |
32 | - public function getArrayCopy() |
|
33 | - { |
|
31 | + public function getArrayCopy() { |
|
34 | 32 | return array(); |
35 | 33 | } |
36 | 34 | |
37 | 35 | /** |
38 | 36 | * @return array |
39 | 37 | */ |
40 | - public function getNames() |
|
41 | - { |
|
38 | + public function getNames() { |
|
42 | 39 | return array(); |
43 | 40 | } |
44 | 41 | |
45 | 42 | /** |
46 | 43 | * @return array |
47 | 44 | */ |
48 | - public function getValues() |
|
49 | - { |
|
45 | + public function getValues() { |
|
50 | 46 | return array(); |
51 | 47 | } |
52 | 48 | |
53 | 49 | /** |
54 | 50 | * @return array |
55 | 51 | */ |
56 | - public function getValuesMap() |
|
57 | - { |
|
52 | + public function getValuesMap() { |
|
58 | 53 | return array(); |
59 | 54 | } |
60 | 55 | } |
@@ -84,8 +84,7 @@ discard block |
||
84 | 84 | * @param array $object_data |
85 | 85 | * @return AbstractObject |
86 | 86 | */ |
87 | - protected function createObject(array $object_data) |
|
88 | - { |
|
87 | + protected function createObject(array $object_data) { |
|
89 | 88 | $object = clone $this->objectPrototype; |
90 | 89 | $object->setDataWithoutValidation($object_data); |
91 | 90 | |
@@ -97,8 +96,7 @@ discard block |
||
97 | 96 | * @return array |
98 | 97 | * @throws \InvalidArgumentException |
99 | 98 | */ |
100 | - protected function assureResponseData(ResponseInterface $response) |
|
101 | - { |
|
99 | + protected function assureResponseData(ResponseInterface $response) { |
|
102 | 100 | $content = $response->getContent(); |
103 | 101 | if (!isset($content['data']) || !is_array($content['data'])) { |
104 | 102 | throw new \InvalidArgumentException("Malformed response data"); |
@@ -110,8 +108,7 @@ discard block |
||
110 | 108 | /** |
111 | 109 | * @param ResponseInterface $response |
112 | 110 | */ |
113 | - protected function prependResponse(ResponseInterface $response) |
|
114 | - { |
|
111 | + protected function prependResponse(ResponseInterface $response) { |
|
115 | 112 | $this->response = $response; |
116 | 113 | $data = $this->assureResponseData($response); |
117 | 114 | if (empty($data)) { |
@@ -130,8 +127,7 @@ discard block |
||
130 | 127 | /** |
131 | 128 | * @param ResponseInterface $response |
132 | 129 | */ |
133 | - protected function appendResponse(ResponseInterface $response) |
|
134 | - { |
|
130 | + protected function appendResponse(ResponseInterface $response) { |
|
135 | 131 | $this->response = $response; |
136 | 132 | $data = $this->assureResponseData($response); |
137 | 133 | if (empty($data)) { |
@@ -154,24 +150,21 @@ discard block |
||
154 | 150 | /** |
155 | 151 | * @return bool |
156 | 152 | */ |
157 | - public static function getDefaultUseImplicitFetch() |
|
158 | - { |
|
153 | + public static function getDefaultUseImplicitFetch() { |
|
159 | 154 | return static::$defaultUseImplicitFetch; |
160 | 155 | } |
161 | 156 | |
162 | 157 | /** |
163 | 158 | * @param bool $use_implicit_fectch |
164 | 159 | */ |
165 | - public static function setDefaultUseImplicitFetch($use_implicit_fectch) |
|
166 | - { |
|
160 | + public static function setDefaultUseImplicitFetch($use_implicit_fectch) { |
|
167 | 161 | static::$defaultUseImplicitFetch = $use_implicit_fectch; |
168 | 162 | } |
169 | 163 | |
170 | 164 | /** |
171 | 165 | * @return bool |
172 | 166 | */ |
173 | - public function getUseImplicitFetch() |
|
174 | - { |
|
167 | + public function getUseImplicitFetch() { |
|
175 | 168 | return $this->useImplicitFectch !== null |
176 | 169 | ? $this->useImplicitFectch |
177 | 170 | : static::$defaultUseImplicitFetch; |
@@ -180,16 +173,14 @@ discard block |
||
180 | 173 | /** |
181 | 174 | * @param bool $use_implicit_fectch |
182 | 175 | */ |
183 | - public function setUseImplicitFetch($use_implicit_fectch) |
|
184 | - { |
|
176 | + public function setUseImplicitFetch($use_implicit_fectch) { |
|
185 | 177 | $this->useImplicitFectch = $use_implicit_fectch; |
186 | 178 | } |
187 | 179 | |
188 | 180 | /** |
189 | 181 | * @return string|null |
190 | 182 | */ |
191 | - public function getBefore() |
|
192 | - { |
|
183 | + public function getBefore() { |
|
193 | 184 | $content = $this->getLastResponse()->getContent(); |
194 | 185 | |
195 | 186 | return isset($content['paging']['cursors']['before']) |
@@ -200,8 +191,7 @@ discard block |
||
200 | 191 | /** |
201 | 192 | * @return string|null |
202 | 193 | */ |
203 | - public function getAfter() |
|
204 | - { |
|
194 | + public function getAfter() { |
|
205 | 195 | $content = $this->getLastResponse()->getContent(); |
206 | 196 | |
207 | 197 | return isset($content['paging']['cursors']['after']) |
@@ -212,8 +202,7 @@ discard block |
||
212 | 202 | /** |
213 | 203 | * @return RequestInterface |
214 | 204 | */ |
215 | - protected function createUndirectionalizedRequest() |
|
216 | - { |
|
205 | + protected function createUndirectionalizedRequest() { |
|
217 | 206 | $request = $this->getLastResponse()->getRequest()->createClone(); |
218 | 207 | $params = $request->getQueryParams(); |
219 | 208 | if (array_key_exists('before', $params)) { |
@@ -229,8 +218,7 @@ discard block |
||
229 | 218 | /** |
230 | 219 | * @return string|null |
231 | 220 | */ |
232 | - public function getPrevious() |
|
233 | - { |
|
221 | + public function getPrevious() { |
|
234 | 222 | $content = $this->getLastResponse()->getContent(); |
235 | 223 | if (isset($content['paging']['previous'])) { |
236 | 224 | return $content['paging']['previous']; |
@@ -249,8 +237,7 @@ discard block |
||
249 | 237 | /** |
250 | 238 | * @return string|null |
251 | 239 | */ |
252 | - public function getNext() |
|
253 | - { |
|
240 | + public function getNext() { |
|
254 | 241 | $content = $this->getLastResponse()->getContent(); |
255 | 242 | if (isset($content['paging']['next'])) { |
256 | 243 | return $content['paging']['next']; |
@@ -270,8 +257,7 @@ discard block |
||
270 | 257 | * @param string $url |
271 | 258 | * @return RequestInterface |
272 | 259 | */ |
273 | - protected function createRequestFromUrl($url) |
|
274 | - { |
|
260 | + protected function createRequestFromUrl($url) { |
|
275 | 261 | $components = parse_url($url); |
276 | 262 | $request = $this->getLastResponse()->getRequest()->createClone(); |
277 | 263 | $request->setDomain($components['host']); |
@@ -286,8 +272,7 @@ discard block |
||
286 | 272 | /** |
287 | 273 | * @return RequestInterface|null |
288 | 274 | */ |
289 | - public function createBeforeRequest() |
|
290 | - { |
|
275 | + public function createBeforeRequest() { |
|
291 | 276 | $url = $this->getPrevious(); |
292 | 277 | return $url !== null ? $this->createRequestFromUrl($url) : null; |
293 | 278 | } |
@@ -295,14 +280,12 @@ discard block |
||
295 | 280 | /** |
296 | 281 | * @return RequestInterface|null |
297 | 282 | */ |
298 | - public function createAfterRequest() |
|
299 | - { |
|
283 | + public function createAfterRequest() { |
|
300 | 284 | $url = $this->getNext(); |
301 | 285 | return $url !== null ? $this->createRequestFromUrl($url) : null; |
302 | 286 | } |
303 | 287 | |
304 | - public function fetchBefore() |
|
305 | - { |
|
288 | + public function fetchBefore() { |
|
306 | 289 | $request = $this->createBeforeRequest(); |
307 | 290 | if (!$request) { |
308 | 291 | return; |
@@ -311,8 +294,7 @@ discard block |
||
311 | 294 | $this->prependResponse($request->execute()); |
312 | 295 | } |
313 | 296 | |
314 | - public function fetchAfter() |
|
315 | - { |
|
297 | + public function fetchAfter() { |
|
316 | 298 | $request = $this->createAfterRequest(); |
317 | 299 | if (!$request) { |
318 | 300 | return; |
@@ -325,8 +307,7 @@ discard block |
||
325 | 307 | * @deprecated Use getArrayCopy() |
326 | 308 | * @return AbstractObject[] |
327 | 309 | */ |
328 | - public function getObjects() |
|
329 | - { |
|
310 | + public function getObjects() { |
|
330 | 311 | return $this->objects; |
331 | 312 | } |
332 | 313 | |
@@ -334,8 +315,7 @@ discard block |
||
334 | 315 | * @param bool $ksort |
335 | 316 | * @return AbstractObject[] |
336 | 317 | */ |
337 | - public function getArrayCopy($ksort = false) |
|
338 | - { |
|
318 | + public function getArrayCopy($ksort = false) { |
|
339 | 319 | if ($ksort) { |
340 | 320 | // Sort the main array to improve best case performance in future |
341 | 321 | // invocations |
@@ -349,50 +329,43 @@ discard block |
||
349 | 329 | * @deprecated Use getLastResponse() |
350 | 330 | * @return ResponseInterface |
351 | 331 | */ |
352 | - public function getResponse() |
|
353 | - { |
|
332 | + public function getResponse() { |
|
354 | 333 | return $this->response; |
355 | 334 | } |
356 | 335 | |
357 | 336 | /** |
358 | 337 | * @return ResponseInterface |
359 | 338 | */ |
360 | - public function getLastResponse() |
|
361 | - { |
|
339 | + public function getLastResponse() { |
|
362 | 340 | return $this->response; |
363 | 341 | } |
364 | 342 | |
365 | 343 | /** |
366 | 344 | * @return int |
367 | 345 | */ |
368 | - public function getIndexLeft() |
|
369 | - { |
|
346 | + public function getIndexLeft() { |
|
370 | 347 | return $this->indexLeft; |
371 | 348 | } |
372 | 349 | |
373 | 350 | /** |
374 | 351 | * @return int |
375 | 352 | */ |
376 | - public function getIndexRight() |
|
377 | - { |
|
353 | + public function getIndexRight() { |
|
378 | 354 | return $this->indexRight; |
379 | 355 | } |
380 | 356 | |
381 | - public function rewind() |
|
382 | - { |
|
357 | + public function rewind() { |
|
383 | 358 | $this->position = $this->indexLeft; |
384 | 359 | } |
385 | 360 | |
386 | - public function end() |
|
387 | - { |
|
361 | + public function end() { |
|
388 | 362 | $this->position = $this->indexRight; |
389 | 363 | } |
390 | 364 | |
391 | 365 | /** |
392 | 366 | * @param int $position |
393 | 367 | */ |
394 | - public function seekTo($position) |
|
395 | - { |
|
368 | + public function seekTo($position) { |
|
396 | 369 | $position = array_key_exists($position, $this->objects) ? $position : null; |
397 | 370 | $this->position = $position; |
398 | 371 | } |
@@ -400,8 +373,7 @@ discard block |
||
400 | 373 | /** |
401 | 374 | * @return AbstractObject|bool |
402 | 375 | */ |
403 | - public function current() |
|
404 | - { |
|
376 | + public function current() { |
|
405 | 377 | return isset($this->objects[$this->position]) |
406 | 378 | ? $this->objects[$this->position] |
407 | 379 | : false; |
@@ -410,13 +382,11 @@ discard block |
||
410 | 382 | /** |
411 | 383 | * @return int |
412 | 384 | */ |
413 | - public function key() |
|
414 | - { |
|
385 | + public function key() { |
|
415 | 386 | return $this->position; |
416 | 387 | } |
417 | 388 | |
418 | - public function prev() |
|
419 | - { |
|
389 | + public function prev() { |
|
420 | 390 | if ($this->position == $this->getIndexLeft()) { |
421 | 391 | if ($this->getUseImplicitFetch()) { |
422 | 392 | $this->fetchBefore(); |
@@ -433,8 +403,7 @@ discard block |
||
433 | 403 | } |
434 | 404 | } |
435 | 405 | |
436 | - public function next() |
|
437 | - { |
|
406 | + public function next() { |
|
438 | 407 | if ($this->position == $this->getIndexRight()) { |
439 | 408 | if ($this->getUseImplicitFetch()) { |
440 | 409 | $this->fetchAfter(); |
@@ -454,16 +423,14 @@ discard block |
||
454 | 423 | /** |
455 | 424 | * @return bool |
456 | 425 | */ |
457 | - public function valid() |
|
458 | - { |
|
426 | + public function valid() { |
|
459 | 427 | return isset($this->objects[$this->position]); |
460 | 428 | } |
461 | 429 | |
462 | 430 | /** |
463 | 431 | * @return int |
464 | 432 | */ |
465 | - public function count() |
|
466 | - { |
|
433 | + public function count() { |
|
467 | 434 | return count($this->objects); |
468 | 435 | } |
469 | 436 | |
@@ -471,8 +438,7 @@ discard block |
||
471 | 438 | * @param mixed $offset |
472 | 439 | * @param mixed $value |
473 | 440 | */ |
474 | - public function offsetSet($offset, $value) |
|
475 | - { |
|
441 | + public function offsetSet($offset, $value) { |
|
476 | 442 | if ($offset === null) { |
477 | 443 | $this->objects[] = $value; |
478 | 444 | } else { |
@@ -484,16 +450,14 @@ discard block |
||
484 | 450 | * @param mixed $offset |
485 | 451 | * @return bool |
486 | 452 | */ |
487 | - public function offsetExists($offset) |
|
488 | - { |
|
453 | + public function offsetExists($offset) { |
|
489 | 454 | return isset($this->objects[$offset]); |
490 | 455 | } |
491 | 456 | |
492 | 457 | /** |
493 | 458 | * @param mixed $offset |
494 | 459 | */ |
495 | - public function offsetUnset($offset) |
|
496 | - { |
|
460 | + public function offsetUnset($offset) { |
|
497 | 461 | unset($this->objects[$offset]); |
498 | 462 | } |
499 | 463 | |
@@ -501,8 +465,7 @@ discard block |
||
501 | 465 | * @param mixed $offset |
502 | 466 | * @return mixed |
503 | 467 | */ |
504 | - public function offsetGet($offset) |
|
505 | - { |
|
468 | + public function offsetGet($offset) { |
|
506 | 469 | return isset($this->objects[$offset]) ? $this->objects[$offset] : null; |
507 | 470 | } |
508 | 471 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds; |
26 | 26 | |
27 | -class Session |
|
28 | -{ |
|
27 | +class Session { |
|
29 | 28 | /** |
30 | 29 | * @var string |
31 | 30 | */ |
@@ -51,8 +50,7 @@ discard block |
||
51 | 50 | * @param string $app_secret |
52 | 51 | * @param string $access_token |
53 | 52 | */ |
54 | - public function __construct($app_id, $app_secret, $access_token) |
|
55 | - { |
|
53 | + public function __construct($app_id, $app_secret, $access_token) { |
|
56 | 54 | $this->appId = $app_id; |
57 | 55 | $this->appSecret = $app_secret; |
58 | 56 | $this->accessToken = $access_token; |
@@ -61,32 +59,28 @@ discard block |
||
61 | 59 | /** |
62 | 60 | * @return string |
63 | 61 | */ |
64 | - public function getAppId() |
|
65 | - { |
|
62 | + public function getAppId() { |
|
66 | 63 | return $this->appId; |
67 | 64 | } |
68 | 65 | |
69 | 66 | /** |
70 | 67 | * @return string |
71 | 68 | */ |
72 | - public function getAppSecret() |
|
73 | - { |
|
69 | + public function getAppSecret() { |
|
74 | 70 | return $this->appSecret; |
75 | 71 | } |
76 | 72 | |
77 | 73 | /** |
78 | 74 | * @return string |
79 | 75 | */ |
80 | - public function getAccessToken() |
|
81 | - { |
|
76 | + public function getAccessToken() { |
|
82 | 77 | return $this->accessToken; |
83 | 78 | } |
84 | 79 | |
85 | 80 | /** |
86 | 81 | * @return string |
87 | 82 | */ |
88 | - public function getAppSecretProof() |
|
89 | - { |
|
83 | + public function getAppSecretProof() { |
|
90 | 84 | if ($this->appSecretProof === null) { |
91 | 85 | $this->appSecretProof = hash_hmac('sha256', $this->getAccessToken(), $this->getAppSecret()); |
92 | 86 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Http; |
26 | 26 | |
27 | -abstract class Util |
|
28 | -{ |
|
27 | +abstract class Util { |
|
29 | 28 | /** |
30 | 29 | * Avoid parse_str() for HHVM compatibility |
31 | 30 | * This implementation is not a complete sobstitute, but covers all the |
@@ -35,8 +34,7 @@ discard block |
||
35 | 34 | * @param $query_string |
36 | 35 | * @return array |
37 | 36 | */ |
38 | - public static function parseUrlQuery($query_string) |
|
39 | - { |
|
37 | + public static function parseUrlQuery($query_string) { |
|
40 | 38 | $query = array(); |
41 | 39 | $pairs = explode('&', $query_string); |
42 | 40 | foreach ($pairs as $pair) { |