Completed
Push — master ( a3140b...10de85 )
by Kacper
04:29
created
Utils/Filter.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function equals($value) : \Closure
36 36
 {
37
-    return function ($argument) use ($value) {
37
+    return function($argument) use ($value) {
38 38
         return $argument == $value;
39 39
     };
40 40
 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function same($value) : \Closure
57 57
 {
58
-    return function ($argument) use ($value) {
58
+    return function($argument) use ($value) {
59 59
         return $argument === $value;
60 60
     };
61 61
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function instance($class) : \Closure
79 79
 {
80
-    return function ($object) use ($class) {
80
+    return function($object) use ($class) {
81 81
         return $object instanceof $class;
82 82
     };
83 83
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function matches($regex, ...$options) : \Closure
105 105
 {
106
-    return function ($value) use ($regex, $options) {
106
+    return function($value) use ($regex, $options) {
107 107
         return preg_match($regex, $value, $null, ...$options) > 0;
108 108
     };
109 109
 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function all(callable ...$functions) : \Closure
179 179
 {
180
-    return function (...$args) use ($functions) {
180
+    return function(...$args) use ($functions) {
181 181
         foreach ($functions as $function) {
182 182
             if (!$function(...$args)) {
183 183
                 return false;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function any(callable ...$functions) : \Closure
208 208
 {
209
-    return function (...$args) use ($functions) {
209
+    return function(...$args) use ($functions) {
210 210
         foreach ($functions as $function) {
211 211
             if ($function(...$args)) {
212 212
                 return true;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
  */
251 251
 function not(callable $predicate) : \Closure
252 252
 {
253
-    return function (...$arguments) use ($predicate) {
253
+    return function(...$arguments) use ($predicate) {
254 254
         return !$predicate(...$arguments);
255 255
     };
256 256
 }
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
  */
279 279
 function argument(int $offset, callable $predicate, $length = true) : \Closure
280 280
 {
281
-    if($length === true) {
281
+    if ($length === true) {
282 282
         $length = 1;
283
-    } elseif($length === false) {
283
+    } elseif ($length === false) {
284 284
         $length = null;
285 285
     }
286 286
 
287
-    return function (...$arguments) use ($predicate, $offset, $length) {
287
+    return function(...$arguments) use ($predicate, $offset, $length) {
288 288
         return $predicate(...array_slice($arguments, $offset, $length, false));
289 289
     };
290 290
 }
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
  */
308 308
 function consecutive(callable ...$predicates)
309 309
 {
310
-    return function (...$arguments) use ($predicates) {
310
+    return function(...$arguments) use ($predicates) {
311 311
         foreach ($arguments as $index => $value) {
312
-            if(!$predicates[$index]($value)) {
312
+            if (!$predicates[$index]($value)) {
313 313
                 return false;
314 314
             }
315 315
         }
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
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function getFrom()
55 55
     {
56
-        if((string)$this->_from !== $this->hasAttribute('from')) {
56
+        if ((string)$this->_from !== $this->hasAttribute('from')) {
57 57
             $this->_from = $this->hasAttribute('from') ? new Jid($this->_from) : null;
58 58
         }
59 59
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function getTo()
64 64
     {
65
-        if((string)$this->_to !== $this->hasAttribute('to')) {
65
+        if ((string)$this->_to !== $this->hasAttribute('to')) {
66 66
             $this->_to = $this->hasAttribute('to') ? new Jid($this->_to) : null;
67 67
         }
68 68
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function setFrom($from)
88 88
     {
89
-        if($from instanceof Jid) {
89
+        if ($from instanceof Jid) {
90 90
             $this->_from = $from instanceof Jid ? $from : new Jid($from);
91 91
         }
92 92
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
     public function setTo($to)
97 97
     {
98
-        if($to instanceof Jid) {
98
+        if ($to instanceof Jid) {
99 99
             $this->_to = $to instanceof Jid ? $to : new Jid($to);
100 100
         }
101 101
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     public static function getXmlCollocations() : array
132 132
     {
133 133
         return [
134
-            [ Error::class, 'name' => 'error', 'uri' => 'jabber:client' ],
134
+            [Error::class, 'name' => 'error', 'uri' => 'jabber:client'],
135 135
         ];
136 136
     }
137 137
 }
Please login to merge, or discard this patch.
Xml/XmlStream.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,32 +92,32 @@  discard block
 block discarded – undo
92 92
 
93 93
         $this->_parser = $parser;
94 94
 
95
-        $this->on('element', function (Error $element) {
95
+        $this->on('element', function(Error $element) {
96 96
             $this->handleError($element);
97 97
         }, with\instance(Error::class));
98 98
 
99
-        $this->_parser->on('parse.begin', function (XmlElement $stream) {
99
+        $this->_parser->on('parse.begin', function(XmlElement $stream) {
100 100
             $this->_inbound = $stream;
101
-            $this->emit('stream.open', [ $stream ]);
101
+            $this->emit('stream.open', [$stream]);
102 102
         }, with\argument(1, with\equals(0)));
103 103
 
104
-        $this->_parser->on('parse.end', function (XmlElement $stream) {
105
-            $this->emit('stream.close', [ $stream ]);
104
+        $this->_parser->on('parse.end', function(XmlElement $stream) {
105
+            $this->emit('stream.close', [$stream]);
106 106
             $this->_inbound = null;
107 107
         }, with\argument(1, with\equals(0)));
108 108
 
109 109
         $this->on('data', [$this->_parser, 'parse']);
110
-        $this->_parser->on('element', function (...$arguments) {
110
+        $this->_parser->on('element', function(...$arguments) {
111 111
             try {
112 112
                 $this->emit('element', $arguments);
113
-            } catch(\Throwable $error) {
114
-                if($this->emit('exception', [ $error ])) {
113
+            } catch (\Throwable $error) {
114
+                if ($this->emit('exception', [$error])) {
115 115
                     throw $error;
116 116
                 }
117 117
             }
118 118
 
119 119
         });
120
-        $this->on('close', function () { $this->_isOpened = false; });
120
+        $this->on('close', function() { $this->_isOpened = false; });
121 121
     }
122 122
 
123 123
     /**
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public function write($data)
131 131
     {
132
-        if($data instanceof XmlElement) {
132
+        if ($data instanceof XmlElement) {
133 133
             $this->_outbound->append($data);
134 134
         }
135 135
 
136
-        $this->emit('send.'.($data instanceof XmlElement ? 'element' : 'text'), [ $data ]);
136
+        $this->emit('send.' . ($data instanceof XmlElement ? 'element' : 'text'), [$data]);
137 137
 
138 138
         return parent::write($data);
139 139
     }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
     private function handleError(Error $element)
196 196
     {
197
-        if ($this->emit('stream.error', [ $element ])) {
197
+        if ($this->emit('stream.error', [$element])) {
198 198
             throw new StreamErrorException($element);
199 199
         }
200 200
 
Please login to merge, or discard this patch.
Xml/XmlParser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         xml_parser_set_option($this->_parser, XML_OPTION_SKIP_WHITE, 1);
72 72
         xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0);
73 73
 
74
-        xml_set_element_handler($this->_parser, function ($parser, $name, $attrs) {
74
+        xml_set_element_handler($this->_parser, function($parser, $name, $attrs) {
75 75
             $this->handleElementStart($name, $attrs);
76
-        }, function () {
76
+        }, function() {
77 77
             $this->handleElementEnd();
78 78
         });
79 79
 
80
-        xml_set_character_data_handler($this->_parser, function ($parser, $data) {
80
+        xml_set_character_data_handler($this->_parser, function($parser, $data) {
81 81
             $this->handleTextData($data);
82 82
         });
83 83
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
             return 'http://www.w3.org/2000/xmlns/';
112 112
         }
113 113
 
114
-        if (isset($namespaces[ $prefix ])) {
115
-            return $namespaces[ $prefix ];
114
+        if (isset($namespaces[$prefix])) {
115
+            return $namespaces[$prefix];
116 116
         }
117 117
 
118 118
         return !empty($this->_stack) ? end($this->_stack)->lookupUri($prefix) : null;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
         list($attributes, $namespaces) = $this->_attributes($attrs);
124 124
         list($tag, $prefix)            = XmlElement::resolve($name);
125 125
 
126
-        $uri   = $this->_lookup($prefix, $namespaces);
126
+        $uri = $this->_lookup($prefix, $namespaces);
127 127
 
128 128
         /** @var XmlElement $element */
129
-        $element = $this->factory->create($uri, $tag, [ $name, $uri ], $this->_getCollocations());
129
+        $element = $this->factory->create($uri, $tag, [$name, $uri], $this->_getCollocations());
130 130
 
131 131
         foreach ($namespaces as $prefix => $uri) {
132 132
             $element->setNamespace($uri, $prefix);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     private function _getCollocations()
142 142
     {
143
-        if(empty($this->_stack)) {
143
+        if (empty($this->_stack)) {
144 144
             return [];
145 145
         }
146 146
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         if (count($this->_stack) > 0) {
160 160
             end($this->_stack)->append($element);
161 161
         }
162
-        $this->emit('parse.begin', [ $element, count($this->_stack) ]);
162
+        $this->emit('parse.begin', [$element, count($this->_stack)]);
163 163
 
164 164
         $this->_stack[] = $element;
165 165
     }
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 
173 173
         $element = array_pop($this->_stack);
174 174
         if (count($this->_stack) == 1) {
175
-            $this->emit('element', [ $element, count($this->_stack) ]);
175
+            $this->emit('element', [$element, count($this->_stack)]);
176 176
         }
177 177
 
178
-        $this->emit('parse.end', [ $element, count($this->_stack) ]);
178
+        $this->emit('parse.end', [$element, count($this->_stack)]);
179 179
     }
180 180
 
181 181
     private function handleTextData($data)
Please login to merge, or discard this patch.