@@ -42,13 +42,13 @@ |
||
42 | 42 | |
43 | 43 | private static function _conditionDescription(Error $error) |
44 | 44 | { |
45 | - if(!empty($error->text)) { |
|
45 | + if (!empty($error->text)) { |
|
46 | 46 | return $error->text; |
47 | 47 | } |
48 | 48 | |
49 | 49 | return [ |
50 | 50 | 'bad-request' => 'Bad Request: "{resource}" is not valid XMPP resource identifier.', |
51 | 51 | 'conflict' => 'Conflict: {bare}/{resource} is already in use.' |
52 | - ][$error->condition] ?? 'Unknown reason: '.$error->condition; |
|
52 | + ][$error->condition] ?? 'Unknown reason: ' . $error->condition; |
|
53 | 53 | } |
54 | 54 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $predicate = $uri instanceof \Closure ? $uri : \Kadet\Xmpp\Utils\filter\same($uri); |
43 | 43 | |
44 | - return function ($element) use ($predicate) { |
|
44 | + return function($element) use ($predicate) { |
|
45 | 45 | if (!$element instanceof XmlElement) { |
46 | 46 | return false; |
47 | 47 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $predicate = $name instanceof \Closure ? $name : \Kadet\Xmpp\Utils\filter\same($name); |
76 | 76 | |
77 | - return function ($element) use ($predicate) { |
|
77 | + return function($element) use ($predicate) { |
|
78 | 78 | if (!$element instanceof XmlElement) { |
79 | 79 | return false; |
80 | 80 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $predicate = $value instanceof \Closure ? $value : \Kadet\Xmpp\Utils\filter\equals($value); |
110 | 110 | |
111 | - return function ($element) use ($name, $predicate) { |
|
111 | + return function($element) use ($name, $predicate) { |
|
112 | 112 | if (!$element instanceof XmlElement) { |
113 | 113 | return false; |
114 | 114 | } |
@@ -53,7 +53,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -71,13 +71,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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 |
||
77 | 77 | */ |
78 | 78 | function instance($expected) : \Closure |
79 | 79 | { |
80 | - return function ($object) use ($expected) { |
|
80 | + return function($object) use ($expected) { |
|
81 | 81 | return $expected instanceof \Closure ? $expected(get_class($object)) : $object instanceof $expected; |
82 | 82 | }; |
83 | 83 | } |
@@ -103,7 +103,7 @@ discard block |
||
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 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return \Closure |
123 | 123 | */ |
124 | 124 | function in(...$options) { |
125 | - return function ($value) use ($options) { |
|
125 | + return function($value) use ($options) { |
|
126 | 126 | return in_array($value, $options); |
127 | 127 | }; |
128 | 128 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | function all(callable ...$functions) : \Closure |
198 | 198 | { |
199 | - return function (...$args) use ($functions) { |
|
199 | + return function(...$args) use ($functions) { |
|
200 | 200 | foreach ($functions as $function) { |
201 | 201 | if (!$function(...$args)) { |
202 | 202 | return false; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | function any(callable ...$functions) : \Closure |
227 | 227 | { |
228 | - return function (...$args) use ($functions) { |
|
228 | + return function(...$args) use ($functions) { |
|
229 | 229 | foreach ($functions as $function) { |
230 | 230 | if ($function(...$args)) { |
231 | 231 | return true; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function not(callable $predicate) : \Closure |
271 | 271 | { |
272 | - return function (...$arguments) use ($predicate) { |
|
272 | + return function(...$arguments) use ($predicate) { |
|
273 | 273 | return !$predicate(...$arguments); |
274 | 274 | }; |
275 | 275 | } |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function argument(int $offset, callable $predicate, $length = true) : \Closure |
299 | 299 | { |
300 | - if($length === true) { |
|
300 | + if ($length === true) { |
|
301 | 301 | $length = 1; |
302 | - } elseif($length === false) { |
|
302 | + } elseif ($length === false) { |
|
303 | 303 | $length = null; |
304 | 304 | } |
305 | 305 | |
306 | - return function (...$arguments) use ($predicate, $offset, $length) { |
|
306 | + return function(...$arguments) use ($predicate, $offset, $length) { |
|
307 | 307 | return $predicate(...array_slice($arguments, $offset, $length, false)); |
308 | 308 | }; |
309 | 309 | } |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | */ |
327 | 327 | function consecutive(callable ...$predicates) |
328 | 328 | { |
329 | - return function (...$arguments) use ($predicates) { |
|
329 | + return function(...$arguments) use ($predicates) { |
|
330 | 330 | foreach ($arguments as $index => $value) { |
331 | - if(!$predicates[$index]($value)) { |
|
331 | + if (!$predicates[$index]($value)) { |
|
332 | 332 | return false; |
333 | 333 | } |
334 | 334 | } |
@@ -91,35 +91,35 @@ discard block |
||
91 | 91 | parent::__construct($transport); |
92 | 92 | $this->setParser($parser); |
93 | 93 | |
94 | - $this->on('close', function () { $this->_isOpened = false; }); |
|
95 | - $this->on('element', function (Error $element) { |
|
94 | + $this->on('close', function() { $this->_isOpened = false; }); |
|
95 | + $this->on('element', function(Error $element) { |
|
96 | 96 | $this->handleError($element); |
97 | 97 | }, with\instance(Error::class)); |
98 | 98 | } |
99 | 99 | |
100 | 100 | public function setParser(XmlParser $parser) |
101 | 101 | { |
102 | - if($this->_parser) { |
|
103 | - $this->removeListener('data', [ $this->_parser, 'parse' ]); |
|
102 | + if ($this->_parser) { |
|
103 | + $this->removeListener('data', [$this->_parser, 'parse']); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $this->_parser = $parser; |
107 | 107 | |
108 | - $this->_parser->on('parse.begin', function (XmlElement $stream) { |
|
108 | + $this->_parser->on('parse.begin', function(XmlElement $stream) { |
|
109 | 109 | $this->_inbound = $stream; |
110 | - $this->emit('stream.open', [ $stream ]); |
|
110 | + $this->emit('stream.open', [$stream]); |
|
111 | 111 | }, with\argument(1, with\equals(0))); |
112 | 112 | |
113 | - $this->_parser->on('parse.end', function (XmlElement $stream) { |
|
114 | - $this->emit('stream.close', [ $stream ]); |
|
113 | + $this->_parser->on('parse.end', function(XmlElement $stream) { |
|
114 | + $this->emit('stream.close', [$stream]); |
|
115 | 115 | $this->_inbound = null; |
116 | 116 | }, with\argument(1, with\equals(0))); |
117 | 117 | |
118 | - $this->_parser->on('element', function (...$arguments) { |
|
118 | + $this->_parser->on('element', function(...$arguments) { |
|
119 | 119 | $this->emit('element', $arguments); |
120 | 120 | }); |
121 | 121 | |
122 | - $this->on('data', [ $this->_parser, 'parse' ]); |
|
122 | + $this->on('data', [$this->_parser, 'parse']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function write($data) |
132 | 132 | { |
133 | - if($data instanceof XmlElement) { |
|
133 | + if ($data instanceof XmlElement) { |
|
134 | 134 | $this->_outbound->append($data); |
135 | 135 | } |
136 | 136 | |
137 | - $this->emit('send.'.($data instanceof XmlElement ? 'element' : 'text'), [ $data ]); |
|
137 | + $this->emit('send.' . ($data instanceof XmlElement ? 'element' : 'text'), [$data]); |
|
138 | 138 | |
139 | 139 | return parent::write($data); |
140 | 140 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | private function handleError(Error $element) |
197 | 197 | { |
198 | - if ($this->emit('stream.error', [ $element ])) { |
|
198 | + if ($this->emit('stream.error', [$element])) { |
|
199 | 199 | throw new StreamErrorException($element); |
200 | 200 | } |
201 | 201 |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @param string $attribute Attribute name, optionally with prefix |
261 | 261 | * @param string|null $uri XML Namespace URI of attribute, prefix will be automatically looked up |
262 | - * @return bool|mixed |
|
262 | + * @return string |
|
263 | 263 | */ |
264 | 264 | public function getAttribute(string $attribute, string $uri = null) |
265 | 265 | { |
@@ -335,6 +335,9 @@ discard block |
||
335 | 335 | return $this->appendChild($element); |
336 | 336 | } |
337 | 337 | |
338 | + /** |
|
339 | + * @param XmlElement $element |
|
340 | + */ |
|
338 | 341 | public function remove($element) |
339 | 342 | { |
340 | 343 | $this->_children = array_filter($this->_children, not(filter\same($element))); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function getInnerXml() |
138 | 138 | { |
139 | - return implode('', array_map(function ($element) { |
|
139 | + return implode('', array_map(function($element) { |
|
140 | 140 | if (is_string($element)) { |
141 | 141 | return htmlspecialchars($element); |
142 | 142 | } elseif ($element instanceof XmlElement) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $attributes = $this->attributes(); |
182 | 182 | |
183 | 183 | $result = "<{$this->name}"; |
184 | - $result .= ' ' . implode(' ', array_map(function ($key, $value) { |
|
184 | + $result .= ' ' . implode(' ', array_map(function($key, $value) { |
|
185 | 185 | return $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; |
186 | 186 | }, array_keys($attributes), array_values($attributes))); |
187 | 187 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function lookupPrefix(string $uri = null) |
204 | 204 | { |
205 | - return $this->getNamespaces()[ $uri ] ?? false; |
|
205 | + return $this->getNamespaces()[$uri] ?? false; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | { |
247 | 247 | $attribute = $this->_prefix($attribute, $uri); |
248 | 248 | if ($value === null) { |
249 | - unset($this->_attributes[ $attribute ]); |
|
249 | + unset($this->_attributes[$attribute]); |
|
250 | 250 | |
251 | 251 | return; |
252 | 252 | } |
253 | 253 | |
254 | - $this->_attributes[ $attribute ] = $value; |
|
254 | + $this->_attributes[$attribute] = $value; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function getAttribute(string $attribute, string $uri = null) |
265 | 265 | { |
266 | - return $this->_attributes[ $this->_prefix($attribute, $uri) ] ?? false; |
|
266 | + return $this->_attributes[$this->_prefix($attribute, $uri)] ?? false; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function hasAttribute(string $attribute, string $uri = null) |
278 | 278 | { |
279 | - return isset($this->_attributes[ $this->_prefix($attribute, $uri) ]); |
|
279 | + return isset($this->_attributes[$this->_prefix($attribute, $uri)]); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function getParents() |
287 | 287 | { |
288 | - return $this->_parent ? array_merge([ $this->_parent ], $this->_parent->getParents()) : []; |
|
288 | + return $this->_parent ? array_merge([$this->_parent], $this->_parent->getParents()) : []; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | protected function setParent(XmlElement $parent) |
305 | 305 | { |
306 | 306 | if (!$this->_prefix && ($prefix = $parent->lookupPrefix($this->namespace)) !== false) { |
307 | - $this->_namespaces[ $this->namespace ] = $prefix; |
|
307 | + $this->_namespaces[$this->namespace] = $prefix; |
|
308 | 308 | $this->_prefix = $prefix; |
309 | 309 | } |
310 | 310 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | return false; |
328 | 328 | } |
329 | 329 | |
330 | - if(is_array($element)) { |
|
330 | + if (is_array($element)) { |
|
331 | 331 | array_walk($element, [$this, 'appendChild']); |
332 | 332 | return $element; |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function remove($element) |
339 | 339 | { |
340 | 340 | $this->_children = array_filter($this->_children, not(filter\same($element))); |
341 | - if($element instanceof XmlElement) { |
|
341 | + if ($element instanceof XmlElement) { |
|
342 | 342 | $element->_parent = null; |
343 | 343 | } |
344 | 344 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $prefix = $this->_prefix; |
389 | 389 | } |
390 | 390 | |
391 | - $this->_namespaces[ $uri ] = $prefix; |
|
391 | + $this->_namespaces[$uri] = $prefix; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | public function getName() |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | public function element(string $name, string $uri = null, int $index = 0) |
438 | 438 | { |
439 | - return array_values($this->elements($name, $uri))[ $index ] ?? false; |
|
439 | + return array_values($this->elements($name, $uri))[$index] ?? false; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | private function attributes(): array |
518 | 518 | { |
519 | 519 | $namespaces = $this->getNamespaces(false); |
520 | - $namespaces = array_map(function ($prefix, $uri) { |
|
520 | + $namespaces = array_map(function($prefix, $uri) { |
|
521 | 521 | return [$prefix ? "xmlns:{$prefix}" : 'xmlns', $uri]; |
522 | 522 | }, array_values($namespaces), array_keys($namespaces)); |
523 | 523 |
@@ -200,7 +200,7 @@ |
||
200 | 200 | * Registers module in client's dependency container. |
201 | 201 | * |
202 | 202 | * @param ComponentInterface $module Module to be registered |
203 | - * @param bool|string|array $alias Module alias, class name by default. |
|
203 | + * @param string|boolean $alias Module alias, class name by default. |
|
204 | 204 | * `true` for aliasing interfaces and parents too, |
205 | 205 | * `false` for aliasing as class name only |
206 | 206 | * array for multiple aliases, |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | |
133 | 133 | $this->applyOptions($options); |
134 | 134 | |
135 | - $this->on('element', function (Features $element) { |
|
135 | + $this->on('element', function(Features $element) { |
|
136 | 136 | $this->_features = $element; |
137 | 137 | $this->emit('features', [$element]); |
138 | 138 | }, Features::class); |
139 | 139 | |
140 | - $this->on('close', function (Features $element) { |
|
140 | + $this->on('close', function(Features $element) { |
|
141 | 141 | $this->state = 'disconnected'; |
142 | 142 | }, Features::class); |
143 | 143 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->state = 'bound'; |
190 | 190 | |
191 | 191 | $queue = new \SplQueue(); |
192 | - $this->emit('init', [ $queue ]); |
|
192 | + $this->emit('init', [$queue]); |
|
193 | 193 | |
194 | 194 | \React\Promise\all(iterator_to_array($queue))->then(function() { |
195 | 195 | $this->state = 'ready'; |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | $this->_container->set(get_class($module), $module); |
214 | 214 | |
215 | 215 | $this->_addToContainer($module, array_merge(class_implements($module), array_slice(class_parents($module), 1))); |
216 | - } elseif(is_array($alias)) { |
|
216 | + } elseif (is_array($alias)) { |
|
217 | 217 | $this->_addToContainer($module, $alias); |
218 | 218 | } else { |
219 | - $this->_addToContainer($module, [ $alias === false ? get_class($module) : $alias ]); |
|
219 | + $this->_addToContainer($module, [$alias === false ? get_class($module) : $alias]); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $deferred = new Deferred(); |
240 | 240 | |
241 | 241 | $this->once('element', function(Stanza $stanza) use ($deferred) { |
242 | - if($stanza->type === "error") { |
|
242 | + if ($stanza->type === "error") { |
|
243 | 243 | $deferred->reject($stanza); |
244 | 244 | } else { |
245 | 245 | $deferred->resolve($stanza); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | //region Parser |
276 | 276 | public function setParser(XmlParser $parser) |
277 | 277 | { |
278 | - if($this->state !== "disconnected") { |
|
278 | + if ($this->state !== "disconnected") { |
|
279 | 279 | throw new \BadMethodCallException('Parser can be changed only when client is disconnected.'); |
280 | 280 | } |
281 | 281 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | )); |
304 | 304 | } |
305 | 305 | |
306 | - $this->_connector->on('connect', function ($stream) { |
|
306 | + $this->_connector->on('connect', function($stream) { |
|
307 | 307 | return $this->handleConnect($stream); |
308 | 308 | }); |
309 | 309 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | foreach ($lookup['<predicate>'] as list($class, $predicate)) { |
36 | - if($predicate($tag, $namespace)) { |
|
36 | + if ($predicate($tag, $namespace)) { |
|
37 | 37 | return $class; |
38 | 38 | } |
39 | 39 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $result = ['<predicate>' => []]; |
66 | 66 | foreach ($dictionary as $element) { |
67 | - if($element['name'] instanceof \Closure || $element['uri'] instanceof \Closure) { |
|
67 | + if ($element['name'] instanceof \Closure || $element['uri'] instanceof \Closure) { |
|
68 | 68 | $result['<predicate>'][] = [$element[0], \Kadet\Xmpp\Utils\filter\consecutive( |
69 | 69 | \Kadet\Xmpp\Utils\filter\predicate($element['name']), |
70 | 70 | \Kadet\Xmpp\Utils\filter\predicate($element['uri']) |