@@ -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 |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | |
132 | 132 | $this->applyOptions($options); |
133 | 133 | |
134 | - $this->on('element', function (Features $element) { |
|
134 | + $this->on('element', function(Features $element) { |
|
135 | 135 | $this->_features = $element; |
136 | 136 | $this->emit('features', [$element]); |
137 | 137 | }, Features::class); |
138 | 138 | |
139 | - $this->on('close', function (Features $element) { |
|
139 | + $this->on('close', function(Features $element) { |
|
140 | 140 | $this->state = 'disconnected'; |
141 | 141 | }, Features::class); |
142 | 142 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $this->state = 'bound'; |
197 | 197 | |
198 | 198 | $queue = new ObservableCollection(); |
199 | - $queue->on('empty', function () { |
|
199 | + $queue->on('empty', function() { |
|
200 | 200 | $this->state = 'ready'; |
201 | 201 | }); |
202 | 202 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $this->_container->set(get_class($module), $module); |
221 | 221 | |
222 | 222 | $this->register($module, array_merge(class_implements($module), array_slice(class_parents($module), 1))); |
223 | - } elseif(is_array($alias)) { |
|
223 | + } elseif (is_array($alias)) { |
|
224 | 224 | foreach ($alias as $name) { |
225 | 225 | if (!$this->has($name)) { |
226 | 226 | $this->register($module, $name); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | //region Parser |
257 | 257 | public function setParser(XmlParser $parser) |
258 | 258 | { |
259 | - if($this->state !== "disconnected") { |
|
259 | + if ($this->state !== "disconnected") { |
|
260 | 260 | throw new \BadMethodCallException('Parser can be changed only when client is disconnected.'); |
261 | 261 | } |
262 | 262 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | )); |
285 | 285 | } |
286 | 286 | |
287 | - $this->_connector->on('connect', function ($stream) { |
|
287 | + $this->_connector->on('connect', function($stream) { |
|
288 | 288 | return $this->handleConnect($stream); |
289 | 289 | }); |
290 | 290 | } |
@@ -207,7 +207,7 @@ |
||
207 | 207 | * Registers module in client's dependency container. |
208 | 208 | * |
209 | 209 | * @param ClientModuleInterface $module Module to be registered |
210 | - * @param bool|string|array $alias Module alias, class name by default. |
|
210 | + * @param string|boolean $alias Module alias, class name by default. |
|
211 | 211 | * `true` for aliasing interfaces and parents too, |
212 | 212 | * `false` for aliasing as class name only |
213 | 213 | * array for multiple aliases, |