Completed
Push — master ( 634839...cd1596 )
by Kacper
03:22
created
Module/SaslAuthenticator.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -69,6 +69,9 @@
 block discarded – undo
69 69
         return true;
70 70
     }
71 71
 
72
+    /**
73
+     * @param string $name
74
+     */
72 75
     private function tryMechanism(Sasl $sasl, $name) {
73 76
         try {
74 77
             $mechanism = $sasl->factory($name, [
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         parent::setClient($client);
52 52
 
53
-        $client->on('features', function (Features $features) {
53
+        $client->on('features', function(Features $features) {
54 54
             return $this->auth($features);
55 55
         });
56 56
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if (!empty($features->mechanisms)) {
61 61
             $sasl = new Sasl();
62 62
             foreach ($features->mechanisms as $name) {
63
-                if($this->tryMechanism($sasl, $name)) {
63
+                if ($this->tryMechanism($sasl, $name)) {
64 64
                     return false;
65 65
                 }
66 66
             }
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
                 $auth->append($response);
93 93
 
94
-                $callback = $this->_client->on('element', function (XmlElement $challenge) use ($mechanism) {
94
+                $callback = $this->_client->on('element', function(XmlElement $challenge) use ($mechanism) {
95 95
                     $this->handleChallenge($challenge, $mechanism);
96 96
                 }, with\all(with\tag('challenge'), with\xmlns(self::XMLNS)));
97 97
 
98
-                $this->_client->once('element', function (XmlElement $result) use ($callback) {
98
+                $this->_client->once('element', function(XmlElement $result) use ($callback) {
99 99
                     $this->_client->removeListener('element', $callback);
100 100
                     $this->handleAuthResult($result, $callback);
101 101
                 }, with\all(with\any(with\tag('success'), with\tag('failure')), with\xmlns(self::XMLNS)));
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     private function handleAuthResult(XmlElement $result, callable $callback)
122 122
     {
123 123
         if ($result->localName === 'failure') {
124
-            throw new AuthenticationException('Unable to auth. '.trim($result->innerXml));
124
+            throw new AuthenticationException('Unable to auth. ' . trim($result->innerXml));
125 125
         }
126 126
 
127 127
         $this->_client->getLogger()->info('Successfully authorized as {name}.', ['name' => (string)$this->_client->jid]);
Please login to merge, or discard this patch.