Completed
Push — master ( 5dbfda...a73b65 )
by Kacper
03:37
created
Component/Roster.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,6 @@
 block discarded – undo
184 184
     }
185 185
 
186 186
     /**
187
-     * @param callable(Item $item) $mapper
188 187
      * @return array
189 188
      */
190 189
     public function map(callable $mapper)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function setClient(XmppClient $client)
49 49
     {
50
-        if($this->_client !== null) {
50
+        if ($this->_client !== null) {
51 51
             throw new BadMethodCallException("You cannot change rosters XmppClient instance.");
52 52
         }
53 53
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     private function handleSet(Iq\Query\Roster $query)
73 73
     {
74 74
         foreach ($query->items as $item) {
75
-            if($item->subscription == 'remove') {
75
+            if ($item->subscription == 'remove') {
76 76
                 $this->removeItem($item->jid);
77 77
             } else {
78 78
                 $this->setItem($item);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         $iq = new Iq('remove', ['query' => new Iq\Query\Roster()]);
171 171
         /** @var Iq\Query\Roster\Item $item */
172
-        foreach($remove as $item) {
172
+        foreach ($remove as $item) {
173 173
             $iq->query->append(new Iq\Query\Roster\Item($item->jid, ['subscription' => 'remove']));
174 174
         }
175 175
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     public function update(Iq\Query\Roster\Item $item)
187 187
     {
188 188
         $iq = new Iq('set', ['query' => new Iq\Query\Roster([
189
-            'items' => [ $item ]
189
+            'items' => [$item]
190 190
         ])]);
191 191
 
192 192
         return $this->_client->send($iq);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
     private function setItem(Iq\Query\Roster\Item $item)
276 276
     {
277
-        $this->emit('item', [ $item ]);
277
+        $this->emit('item', [$item]);
278 278
         $this->_items[(string)$item->jid] = $item;
279 279
     }
280 280
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             return;
288 288
         }
289 289
 
290
-        $this->emit('remove', [ $this->_items[(string)$jid] ]);
290
+        $this->emit('remove', [$this->_items[(string)$jid]]);
291 291
         unset($this->_items[(string)$jid]);
292 292
     }
293 293
 }
Please login to merge, or discard this patch.
Stanza/Iq/Query/Roster.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     protected function appendChild($element)
88 88
     {
89
-        if(!$element instanceof Item) {
89
+        if (!$element instanceof Item) {
90 90
             throw new InvalidArgumentException(format('Only instances of roster item ({expected}) can be added into roster, tried to add {actual}', [
91 91
                 'expected' => Item::class,
92 92
                 'actual'   => get_class($element)
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public static function getXmlCollocations() : array
100 100
     {
101 101
         return [
102
-            [ Item::class, 'name' => 'item', 'uri' => 'jabber:iq:roster' ]
102
+            [Item::class, 'name' => 'item', 'uri' => 'jabber:iq:roster']
103 103
         ];
104 104
     }
105 105
 }
Please login to merge, or discard this patch.
XmppClient.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
 
149 149
         $this->applyOptions($options);
150 150
 
151
-        $this->on('element', function (Features $element) {
151
+        $this->on('element', function(Features $element) {
152 152
             $this->_features = $element;
153 153
             $this->emit('features', [$element]);
154 154
         }, Features::class);
155 155
 
156
-        $this->on('element', function (Stanza $stanza) {
157
-            $this->emit('stanza', [ $stanza ]);
158
-            $this->emit($stanza->localName, [ $stanza ]);
156
+        $this->on('element', function(Stanza $stanza) {
157
+            $this->emit('stanza', [$stanza]);
158
+            $this->emit($stanza->localName, [$stanza]);
159 159
         }, Stanza::class);
160 160
 
161
-        $this->on('close', function () {
161
+        $this->on('close', function() {
162 162
             $this->state = 'disconnected';
163 163
         });
164 164
     }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->state = 'bound';
212 212
 
213 213
         $queue = new \SplQueue();
214
-        $this->emit('init', [ $queue ]);
214
+        $this->emit('init', [$queue]);
215 215
 
216 216
         \React\Promise\all(iterator_to_array($queue))->then(function() {
217 217
             $this->state = 'ready';
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 
236 236
         if ($alias === true) {
237 237
             $this->_addToContainer($module, array_merge(class_implements($module), array_slice(class_parents($module), 1)));
238
-        } elseif(is_array($alias)) {
238
+        } elseif (is_array($alias)) {
239 239
             $this->_addToContainer($module, $alias);
240 240
         } else {
241
-            $this->_addToContainer($module, [ $alias === false ? get_class($module) : $alias ]);
241
+            $this->_addToContainer($module, [$alias === false ? get_class($module) : $alias]);
242 242
         }
243 243
     }
244 244
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $deferred = new Deferred();
262 262
 
263 263
         $this->once('element', function(Stanza $stanza) use ($deferred) {
264
-            if($stanza->type === "error") {
264
+            if ($stanza->type === "error") {
265 265
                 $deferred->reject($stanza);
266 266
             } else {
267 267
                 $deferred->resolve($stanza);
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     //region Parser
298 298
     public function setParser(XmlParser $parser)
299 299
     {
300
-        if($this->state !== "disconnected") {
300
+        if ($this->state !== "disconnected") {
301 301
             throw new \BadMethodCallException('Parser can be changed only when client is disconnected.');
302 302
         }
303 303
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
             ));
326 326
         }
327 327
 
328
-        $this->_connector->on('connect', function ($stream) {
328
+        $this->_connector->on('connect', function($stream) {
329 329
             return $this->handleConnect($stream);
330 330
         });
331 331
     }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@
 block discarded – undo
267 267
             } else {
268 268
                 $deferred->resolve($stanza);
269 269
             }
270
-         }, with\stanza\id($stanza->id));
270
+            }, with\stanza\id($stanza->id));
271 271
         $this->write($stanza);
272 272
 
273 273
         return $deferred->promise();
Please login to merge, or discard this patch.
Sasl/DigestMD5.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     public function createResponse($challenge = null)
30 30
     {
31
-        if(strpos($challenge, 'rspauth=') !== false) {
31
+        if (strpos($challenge, 'rspauth=') !== false) {
32 32
             return '';
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Utils/DnsResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
                 continue;
57 57
             }
58 58
 
59
-            $this->_results = array_merge($this->_results, array_map(function ($record) use($type) {
59
+            $this->_results = array_merge($this->_results, array_map(function($record) use($type) {
60 60
                 return $type === DNS_SRV
61 61
                     ? [$record['target'], $record['port']]
62 62
                     : [$record['ip'], $this->_port];
Please login to merge, or discard this patch.
Component/Subscription/SubscriptionManager.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     /**
56 56
      * Sends subscription removal request presence to server.
57 57
      *
58
-     * @param Jid|string $jid
58
+     * @param Jid $jid
59 59
      * @return \React\Promise\ExtendedPromiseInterface
60 60
      */
61 61
     public function unsubscribe(Jid $jid)
@@ -74,6 +74,9 @@  discard block
 block discarded – undo
74 74
         return $this->_client->send($this->presence('unsubscribed', $jid));
75 75
     }
76 76
 
77
+    /**
78
+     * @param string $type
79
+     */
77 80
     private function presence($type, $jid)
78 81
     {
79 82
         $jid = $jid instanceof Jid ? $jid : new Jid($jid);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
     private function handleSubscriptionRequest(Presence $presence)
40 40
     {
41
-        $this->emit('request', [ $presence ]);
41
+        $this->emit('request', [$presence]);
42 42
     }
43 43
 
44 44
     /**
Please login to merge, or discard this patch.
Component/TlsEnabler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 use Kadet\Xmpp\Stream\Features;
21 21
 use Kadet\Xmpp\Utils\filter as with;
22 22
 use Kadet\Xmpp\Xml\XmlElement;
23
-use Kadet\Xmpp\XmppClient;
24 23
 
25 24
 class TlsEnabler extends Component
26 25
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@
 block discarded – undo
26 26
 {
27 27
     public function init()
28 28
     {
29
-        $this->_client->on('features', function (Features $features) {
29
+        $this->_client->on('features', function(Features $features) {
30 30
             return !$this->startTls($features);
31 31
         }, null, 10);
32 32
 
33
-        $this->_client->on('element', function (XmlElement $element) {
33
+        $this->_client->on('element', function(XmlElement $element) {
34 34
             return $this->handleTls($element);
35 35
         }, with\element\xmlns(Features\StartTls::XMLNS));
36 36
     }
Please login to merge, or discard this patch.
Network/Connector/TcpXmppConnector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@
 block discarded – undo
44 44
                 stream_context_set_option($stream, 'ssl', 'peer_name', $this->_host);
45 45
 
46 46
                 $stream = new TcpStream($stream, $this->_loop);
47
-                $this->emit('connect', [ $stream ]);
47
+                $this->emit('connect', [$stream]);
48 48
 
49 49
                 return $stream;
50 50
             }
51 51
         }
52 52
 
53
-        throw new \RuntimeException('Cannot connect to '.$this->_host);
53
+        throw new \RuntimeException('Cannot connect to ' . $this->_host);
54 54
     }
55 55
 
56 56
     public function __construct(string $host, LoopInterface $loop)
Please login to merge, or discard this patch.
Stanza/Stanza.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function getFrom()
57 57
     {
58
-        if((string)$this->_from !== $this->hasAttribute('from')) {
58
+        if ((string)$this->_from !== $this->hasAttribute('from')) {
59 59
             $this->_from = $this->hasAttribute('from') ? new Jid($this->getAttribute('from')) : null;
60 60
         }
61 61
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function getTo()
66 66
     {
67
-        if((string)$this->_to !== $this->hasAttribute('to')) {
67
+        if ((string)$this->_to !== $this->hasAttribute('to')) {
68 68
             $this->_to = $this->hasAttribute('to') ? new Jid($this->getAttribute('to')) : null;
69 69
         }
70 70
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
     public function setFrom($from)
90 90
     {
91
-        if($from instanceof Jid) {
91
+        if ($from instanceof Jid) {
92 92
             $this->_from = $from instanceof Jid ? $from : new Jid($from);
93 93
         }
94 94
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
     public function setTo($to)
99 99
     {
100
-        if($to instanceof Jid) {
100
+        if ($to instanceof Jid) {
101 101
             $this->_to = $to instanceof Jid ? $to : new Jid($to);
102 102
         }
103 103
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     public static function getXmlCollocations() : array
134 134
     {
135 135
         return [
136
-            [ Error::class, 'name' => 'error', 'uri' => 'jabber:client' ],
136
+            [Error::class, 'name' => 'error', 'uri' => 'jabber:client'],
137 137
         ];
138 138
     }
139 139
 }
Please login to merge, or discard this patch.