@@ -246,7 +246,7 @@ |
||
| 246 | 246 | */ |
| 247 | 247 | protected function __toArray() |
| 248 | 248 | { |
| 249 | - return array_map(function ($value) { |
|
| 249 | + return array_map(function($value) { |
|
| 250 | 250 | if (is_object($value) && method_exists($value, 'toArray')) { |
| 251 | 251 | return $value->toArray(); |
| 252 | 252 | } else { |
@@ -70,11 +70,11 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | protected function checkTimeRange() |
| 72 | 72 | { |
| 73 | - if (! ($this->start instanceof Carbon)) { |
|
| 73 | + if (!($this->start instanceof Carbon)) { |
|
| 74 | 74 | throw new \Exception('开始时间不能为空'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! ($this->end instanceof Carbon)) { |
|
| 77 | + if (!($this->end instanceof Carbon)) { |
|
| 78 | 78 | throw new \Exception('结束时间不能为空'); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | public function setResource($resource, $checkValid = true) |
| 172 | 172 | { |
| 173 | 173 | if ($checkValid && !Resources::checkResource($resource)) { |
| 174 | - throw new InvalidResourceException('Invalid resource:' . $resource); |
|
| 174 | + throw new InvalidResourceException('Invalid resource:'.$resource); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $this->resource = $resource; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function getRequestUrl($action) |
| 199 | 199 | { |
| 200 | 200 | if (!Resources::checkResource($resource = $this->getResource())) { |
| 201 | - throw new InvalidResourceException('Invalid resource:' . $resource); |
|
| 201 | + throw new InvalidResourceException('Invalid resource:'.$resource); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | return sprintf('%s/%s/%s/%s', $this->getBaseUrl(), $this->getVersion(), $resource, $action); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | public function request($action, $params = [], $headers = [], $returnRaw = false) |
| 222 | 222 | { |
| 223 | 223 | if (!$this->checkAction($action)) { |
| 224 | - throw new InvalidActionException("resource {$this->getResource()} does not support action:" . |
|
| 224 | + throw new InvalidActionException("resource {$this->getResource()} does not support action:". |
|
| 225 | 225 | "{$action}, please check the official documentation"); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | */ |
| 397 | 397 | protected function accessTokenMiddleware() |
| 398 | 398 | { |
| 399 | - return function ($handler) { |
|
| 400 | - return function ($request, $options) use ($handler) { |
|
| 399 | + return function($handler) { |
|
| 400 | + return function($request, $options) use ($handler) { |
|
| 401 | 401 | $option['query']['access_token'] = $this->getAccessToken(); |
| 402 | 402 | $option['query']['timestamp'] = time(); |
| 403 | 403 | $option['query']['nonce'] = Support\generate_nonce(); |
@@ -414,8 +414,8 @@ discard block |
||
| 414 | 414 | */ |
| 415 | 415 | protected function advertiserIdMiddleware() |
| 416 | 416 | { |
| 417 | - return function ($handler) { |
|
| 418 | - return function ($request, $options) use ($handler) { |
|
| 417 | + return function($handler) { |
|
| 418 | + return function($request, $options) use ($handler) { |
|
| 419 | 419 | $option['form_params']['account_id'] = $this->getAdvertiserId(); |
| 420 | 420 | |
| 421 | 421 | return $handler($request, $options); |