Completed
Push — master ( cd1596...641e7a )
by Kacper
03:28
created
Module/SaslAuthenticator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         parent::setClient($client);
61 61
 
62
-        $client->on('features', function (Features $features) {
62
+        $client->on('features', function(Features $features) {
63 63
             return !$this->auth($features);
64 64
         });
65 65
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         if (!empty($features->mechanisms)) {
70 70
             foreach ($features->mechanisms as $name) {
71
-                if($this->tryMechanism($name)) {
71
+                if ($this->tryMechanism($name)) {
72 72
                     return true;
73 73
                 }
74 74
             }
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
             $response = '=';
113 113
         }
114 114
 
115
-        $callback = $this->_client->on('element', function (XmlElement $challenge) use ($mechanism) {
115
+        $callback = $this->_client->on('element', function(XmlElement $challenge) use ($mechanism) {
116 116
             $this->handleChallenge($challenge, $mechanism);
117 117
         }, with\all(with\tag('challenge'), with\xmlns(self::XMLNS)));
118 118
 
119
-        $this->_client->once('element', function (XmlElement $result) use ($callback) {
119
+        $this->_client->once('element', function(XmlElement $result) use ($callback) {
120 120
             $this->_client->removeListener('element', $callback);
121 121
             $this->handleAuthResult($result);
122 122
         }, with\all(with\any(with\tag('success'), with\tag('failure')), with\xmlns(self::XMLNS)));
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     private function mechanismWithoutChallenge(AuthenticationInterface $mechanism)
128 128
     {
129
-        $this->_client->once('element', function (XmlElement $result) {
129
+        $this->_client->once('element', function(XmlElement $result) {
130 130
             $this->handleAuthResult($result);
131 131
         }, with\all(with\any(with\tag('success'), with\tag('failure')), with\xmlns(self::XMLNS)));
132 132
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     private function handleAuthResult(XmlElement $result)
145 145
     {
146 146
         if ($result->localName === 'failure') {
147
-            throw new AuthenticationException('Unable to auth. '.trim($result->innerXml));
147
+            throw new AuthenticationException('Unable to auth. ' . trim($result->innerXml));
148 148
         }
149 149
 
150 150
         $this->_client->getLogger()->info('Successfully authorized as {name}.', ['name' => (string)$this->_client->jid]);
Please login to merge, or discard this patch.
Xml/XmlElement.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $this->init($name, $uri);
107 107
         $this->append($content);
108
-        foreach($attributes as $name => $value) {
108
+        foreach ($attributes as $name => $value) {
109 109
             $this->setAttribute($name, $value);
110 110
         }
111 111
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     public function getInnerXml()
136 136
     {
137
-        return implode('', array_map(function ($element) {
137
+        return implode('', array_map(function($element) {
138 138
             if (is_string($element)) {
139 139
                 return htmlspecialchars($element);
140 140
             } elseif ($element instanceof XmlElement) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $attributes = $this->attributes();
162 162
 
163 163
         $result = "<{$this->name}";
164
-        $result .= ' ' . implode(' ', array_map(function ($key, $value) {
164
+        $result .= ' ' . implode(' ', array_map(function($key, $value) {
165 165
             return $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"';
166 166
         }, array_keys($attributes), array_values($attributes)));
167 167
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function lookupPrefix(string $uri = null)
184 184
     {
185
-        return $this->getNamespaces()[ $uri ] ?? false;
185
+        return $this->getNamespaces()[$uri] ?? false;
186 186
     }
187 187
 
188 188
     /**
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $attribute = $this->_prefix($attribute, $uri);
228 228
         if ($value === null) {
229
-            unset($this->_attributes[ $attribute ]);
229
+            unset($this->_attributes[$attribute]);
230 230
 
231 231
             return;
232 232
         }
233 233
 
234
-        $this->_attributes[ $attribute ] = $value;
234
+        $this->_attributes[$attribute] = $value;
235 235
     }
236 236
 
237 237
     /**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function getAttribute(string $attribute, string $uri = null)
245 245
     {
246
-        return $this->_attributes[ $this->_prefix($attribute, $uri) ] ?? false;
246
+        return $this->_attributes[$this->_prefix($attribute, $uri)] ?? false;
247 247
     }
248 248
 
249 249
     /**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function hasAttribute(string $attribute, string $uri = null)
258 258
     {
259
-        return isset($this->_attributes[ $this->_prefix($attribute, $uri) ]);
259
+        return isset($this->_attributes[$this->_prefix($attribute, $uri)]);
260 260
     }
261 261
 
262 262
     /**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     protected function setParent(XmlElement $parent)
276 276
     {
277 277
         if (!$this->_prefix && ($prefix = $parent->lookupPrefix($this->namespace)) !== false) {
278
-            $this->_namespaces[ $this->namespace ] = $prefix;
278
+            $this->_namespaces[$this->namespace] = $prefix;
279 279
             $this->_prefix                         = $prefix;
280 280
         }
281 281
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             return false;
299 299
         }
300 300
 
301
-        if(is_array($element)) {
301
+        if (is_array($element)) {
302 302
             array_walk($element, [$this, 'append']);
303 303
             return $element;
304 304
         }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             $prefix = $this->_prefix;
343 343
         }
344 344
 
345
-        $this->_namespaces[ $uri ] = $prefix;
345
+        $this->_namespaces[$uri] = $prefix;
346 346
     }
347 347
 
348 348
     public function getName()
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      */
382 382
     public function element(string $name, string $uri = null, int $index = 0)
383 383
     {
384
-        return array_values($this->elements($name, $uri))[ $index ] ?? false;
384
+        return array_values($this->elements($name, $uri))[$index] ?? false;
385 385
     }
386 386
 
387 387
     /**
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     private function attributes(): array
456 456
     {
457 457
         $namespaces = $this->getNamespaces(false);
458
-        $namespaces = array_map(function ($prefix, $uri) {
458
+        $namespaces = array_map(function($prefix, $uri) {
459 459
             return [$prefix ? "xmlns:{$prefix}" : 'xmlns', $uri];
460 460
         }, array_values($namespaces), array_keys($namespaces));
461 461
 
Please login to merge, or discard this patch.