@@ -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 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | self::checkCredentials($login, $password); |
| 21 | 21 | |
| 22 | 22 | return new RequestsContainer( |
| 23 | - new GuzzleHttpClient(new Client()), |
|
| 23 | + new GuzzleHttpClient(new Client()), |
|
| 24 | 24 | $login, |
| 25 | 25 | $password |
| 26 | 26 | ); |
@@ -100,8 +100,8 @@ |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | - * @param $action |
|
| 104 | - * @return string |
|
| 103 | + * @param string $action |
|
| 104 | + * @return Request |
|
| 105 | 105 | * @throws WrongRequest |
| 106 | 106 | */ |
| 107 | 107 | public function resolveRequestByAction($action) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @var Request[] |
| 47 | 47 | */ |
| 48 | - protected $requests = []; |
|
| 48 | + protected $requests = [ ]; |
|
| 49 | 49 | |
| 50 | 50 | public function __construct(GuzzleHttpClient $http, $login, $password) |
| 51 | 51 | { |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | public function getRequest($requestClass) |
| 94 | 94 | { |
| 95 | 95 | // Check if an instance has already been initiated |
| 96 | - if (!isset($this->requests[$requestClass])) { |
|
| 96 | + if (!isset($this->requests[ $requestClass ])) { |
|
| 97 | 97 | $this->addRequest($requestClass); |
| 98 | 98 | } |
| 99 | - return $this->requests[$requestClass]; |
|
| 99 | + return $this->requests[ $requestClass ]; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function resolveRequestByAction($action) |
| 108 | 108 | { |
| 109 | 109 | foreach ($this->getRequestsActionsMap() as $requestClass => $actions) { |
| 110 | - if(in_array($action, $actions)) { |
|
| 110 | + if (in_array($action, $actions)) { |
|
| 111 | 111 | return $this->getRequest($requestClass); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | if (!class_exists($requestClass)) { |
| 129 | 129 | throw new WrongRequest("Request $requestClass not found."); |
| 130 | 130 | } |
| 131 | - $this->requests[$requestClass] = $this->buildRequest($requestClass); |
|
| 131 | + $this->requests[ $requestClass ] = $this->buildRequest($requestClass); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | protected function buildRequest($className) |
| 142 | 142 | { |
| 143 | 143 | return (new ReflectionClass($className)) |
| 144 | - ->newInstanceArgs([$this->http]) |
|
| 144 | + ->newInstanceArgs([ $this->http ]) |
|
| 145 | 145 | ->setCredentials($this->login, $this->password); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param array $params |
| 39 | 39 | * @return array|null |
| 40 | 40 | */ |
| 41 | - public function exec($action, $params = []) |
|
| 41 | + public function exec($action, $params = [ ]) |
|
| 42 | 42 | { |
| 43 | 43 | $endPoint = $this->makeEndPoint($action); |
| 44 | 44 | $requestBody = $this->createRequestBody($params); |
@@ -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 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | protected function formatRequestBody(array $requestBody) |
| 149 | 149 | { |
| 150 | - return ['json' => $requestBody]; |
|
| 150 | + return [ 'json' => $requestBody ]; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | */ |
| 112 | 112 | protected function formatRequestBody(array $requestBody) |
| 113 | 113 | { |
| 114 | - return ['body' => (new XMLFormatter($requestBody))->toXml()]; |
|
| 114 | + return [ 'body' => (new XMLFormatter($requestBody))->toXml() ]; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param array $params |
| 25 | 25 | * @return string |
| 26 | 26 | */ |
| 27 | - public function get($uri, $params = []) |
|
| 27 | + public function get($uri, $params = [ ]) |
|
| 28 | 28 | { |
| 29 | 29 | if (!empty($params)) { |
| 30 | 30 | $uri .= '?' . http_build_query($params); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param array $body |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public function post($uri, $body = []) |
|
| 41 | + public function post($uri, $body = [ ]) |
|
| 42 | 42 | { |
| 43 | 43 | return $this->client->post($uri, $body)->getBody(); |
| 44 | 44 | } |