@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function cancel($smsId) |
| 26 | 26 | { |
| 27 | - return $this->exec('cancel', ['smsid' => $smsId]); |
|
| 27 | + return $this->exec('cancel', [ 'smsid' => $smsId ]); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function getReportBySms($smsId) |
| 71 | 71 | { |
| 72 | - return $this->exec('report', ['smsid' => $smsId]); |
|
| 72 | + return $this->exec('report', [ 'smsid' => $smsId ]); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | return $this->exec('balance'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function exec($action, $params = [], $method = 'POST') |
|
| 101 | + public function exec($action, $params = [ ], $method = 'POST') |
|
| 102 | 102 | { |
| 103 | 103 | return parent::exec($action, $params, $method); |
| 104 | 104 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @var array |
| 12 | 12 | */ |
| 13 | - public static $allowedMethod = []; |
|
| 13 | + public static $allowedMethod = [ ]; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @var ClientInterface |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @return array|null |
| 56 | 56 | * @throws \GuzzleHttp\Exception\GuzzleException |
| 57 | 57 | */ |
| 58 | - public function exec($action, $params = [], $method = 'GET') |
|
| 58 | + public function exec($action, $params = [ ], $method = 'GET') |
|
| 59 | 59 | { |
| 60 | 60 | $endPoint = $this->makeEndPoint($action); |
| 61 | 61 | $requestBody = $this->createRequestBody($params); |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | $respArr = $this->parseResponse($response->getBody()->getContents()); |
| 68 | 68 | |
| 69 | 69 | if (is_array($respArr) && array_key_exists('error_descr', $respArr)) { |
| 70 | - $respArr = array_merge(['code' => 0, 'descr' => '', 'error_descr' => []], $respArr); // screw the notices! |
|
| 71 | - throw new BaseSmsIntelException($respArr['descr'], $respArr['code'], $respArr['error_descr']); |
|
| 70 | + $respArr = array_merge([ 'code' => 0, 'descr' => '', 'error_descr' => [ ] ], $respArr); // screw the notices! |
|
| 71 | + throw new BaseSmsIntelException($respArr[ 'descr' ], $respArr[ 'code' ], $respArr[ 'error_descr' ]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | return $respArr; |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | switch (strtoupper($method)) { |
| 104 | 104 | case 'GET': |
| 105 | - return ['query' => $requestBody]; |
|
| 105 | + return [ 'query' => $requestBody ]; |
|
| 106 | 106 | case 'POST': |
| 107 | 107 | $body = is_array($requestBody) ? \GuzzleHttp\json_encode($requestBody) : $requestBody; |
| 108 | - return ['body' => $body]; |
|
| 108 | + return [ 'body' => $body ]; |
|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * @var AbstractRequest[] |
| 46 | 46 | */ |
| 47 | - protected $requests = []; |
|
| 47 | + protected $requests = [ ]; |
|
| 48 | 48 | |
| 49 | 49 | public function __construct(ClientInterface $http, $login, $password) |
| 50 | 50 | { |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | public function getRequest($requestClass) |
| 93 | 93 | { |
| 94 | 94 | // Check if an instance has already been initiated |
| 95 | - if (!isset($this->requests[$requestClass])) { |
|
| 95 | + if (!isset($this->requests[ $requestClass ])) { |
|
| 96 | 96 | $this->addRequest($requestClass); |
| 97 | 97 | } |
| 98 | - return $this->requests[$requestClass]; |
|
| 98 | + return $this->requests[ $requestClass ]; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function resolveRequestByAction($action) |
| 107 | 107 | { |
| 108 | 108 | foreach ($this->getRequestsActionsMap() as $requestClass => $actions) { |
| 109 | - if(in_array($action, $actions)) { |
|
| 109 | + if (in_array($action, $actions)) { |
|
| 110 | 110 | return $this->getRequest($requestClass); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | if (!class_exists($requestClass)) { |
| 128 | 128 | throw new WrongRequestException("Request $requestClass not found."); |
| 129 | 129 | } |
| 130 | - $this->requests[$requestClass] = $this->buildRequest($requestClass); |
|
| 130 | + $this->requests[ $requestClass ] = $this->buildRequest($requestClass); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | protected function buildRequest($className) |
| 141 | 141 | { |
| 142 | 142 | return (new ReflectionClass($className)) |
| 143 | - ->newInstanceArgs([$this->guzzle]) |
|
| 143 | + ->newInstanceArgs([ $this->guzzle ]) |
|
| 144 | 144 | ->setCredentials($this->login, $this->password); |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | \ No newline at end of file |