@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function requestSource($name) |
| 50 | 50 | { |
| 51 | - return $this->exec('requestSource', ['source' => $name]); |
|
| 51 | + return $this->exec('requestSource', [ 'source' => $name ]); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | return $this->exec( |
| 62 | 62 | 'getContacts', |
| 63 | - ['idGroup' => $groupId, 'phone' => $phone] |
|
| 63 | + [ 'idGroup' => $groupId, 'phone' => $phone ] |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function getPhoneInfo($phone) |
| 72 | 72 | { |
| 73 | - return $this->exec('getPhoneInfo', ['phone' => $phone]); |
|
| 73 | + return $this->exec('getPhoneInfo', [ 'phone' => $phone ]); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | return $this->exec( |
| 93 | 93 | 'getGroups', |
| 94 | - ['id' => $groupId, 'name' => $groupName] |
|
| 94 | + [ 'id' => $groupId, 'name' => $groupName ] |
|
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function editGroup($name, $groupId) |
| 113 | 113 | { |
| 114 | - return $this->exec('saveGroup', ['id' => $groupId, 'name' => $name]); |
|
| 114 | + return $this->exec('saveGroup', [ 'id' => $groupId, 'name' => $name ]); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function removeContact($phone, $groupId = null) |
| 131 | 131 | { |
| 132 | - return $this->exec('removeContact', ['phone' => $phone, 'groupId' => $groupId]); |
|
| 132 | + return $this->exec('removeContact', [ 'phone' => $phone, 'groupId' => $groupId ]); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -54,10 +54,10 @@ |
||
| 54 | 54 | /** |
| 55 | 55 | * @codeCoverageIgnore |
| 56 | 56 | */ |
| 57 | - private function __construct(){} |
|
| 57 | + private function __construct() {} |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @codeCoverageIgnore |
| 61 | 61 | */ |
| 62 | - private function __clone(){} |
|
| 62 | + private function __clone() {} |
|
| 63 | 63 | } |
@@ -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 |