@@ -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 |