Completed
Pull Request — master (#20)
by Alexander
10:01
created
src/Exceptions/BaseSmsIntelException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     /** @var array */
10 10
     protected $errorData;
11 11
 
12
-    public function __construct($message = "", $code = 0, array $errorData = [], Throwable $previous = null)
12
+    public function __construct($message = "", $code = 0, array $errorData = [ ], Throwable $previous = null)
13 13
     {
14 14
         parent::__construct($message, $code, $previous);
15 15
         $this->errorData = $errorData;
Please login to merge, or discard this patch.
src/Api/Requests/XMLRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Api/Requests/JSONRequest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
      * @param array $params
27 27
      * @return array|null
28 28
      */
29
-    public function send($to, $from, $message, $params = [])
29
+    public function send($to, $from, $message, $params = [ ])
30 30
     {
31
-        $to = is_array($to) ? $to : [$to];
32
-        $to = array_map(function ($phone) {
31
+        $to = is_array($to) ? $to : [ $to ];
32
+        $to = array_map(function($phone) {
33 33
             return preg_replace('/[^\d]/', '', $phone);
34 34
         }, $to);
35 35
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function requestSource($name)
53 53
     {
54
-        return $this->exec('requestSource', ['source' => $name]);
54
+        return $this->exec('requestSource', [ 'source' => $name ]);
55 55
     }
56 56
 
57 57
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         return $this->exec(
65 65
             'getContacts',
66
-            ['idGroup' => $groupId, 'phone' => $phone]
66
+            [ 'idGroup' => $groupId, 'phone' => $phone ]
67 67
         );
68 68
     }
69 69
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function getPhoneInfo($phone)
75 75
     {
76
-        return $this->exec('getPhoneInfo', ['phone' => $phone]);
76
+        return $this->exec('getPhoneInfo', [ 'phone' => $phone ]);
77 77
     }
78 78
 
79 79
     /**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         return $this->exec(
96 96
             'getGroups',
97
-            ['id' => $groupId, 'name' => $groupName]
97
+            [ 'id' => $groupId, 'name' => $groupName ]
98 98
         );
99 99
     }
100 100
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function editGroup($name, $groupId)
116 116
     {
117
-        return $this->exec('saveGroup', ['id' => $groupId, 'name' => $name]);
117
+        return $this->exec('saveGroup', [ 'id' => $groupId, 'name' => $name ]);
118 118
     }
119 119
 
120 120
     /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      */
133 133
     public function removeContact($phone, $groupId = null)
134 134
     {
135
-        return $this->exec('removeContact', ['phone' => $phone, 'groupId' => $groupId]);
135
+        return $this->exec('removeContact', [ 'phone' => $phone, 'groupId' => $groupId ]);
136 136
     }
137 137
 
138 138
     /**
Please login to merge, or discard this patch.
src/Api/Requests/RequestsContainer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Api/Requests/AbstractRequest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.