@@ -76,25 +76,25 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $this->_parser = $parser; |
| 78 | 78 | |
| 79 | - $this->on('element', function (Error $element) { |
|
| 79 | + $this->on('element', function(Error $element) { |
|
| 80 | 80 | $this->handleError($element); |
| 81 | 81 | }, with\ofType(Error::class)); |
| 82 | 82 | |
| 83 | - $this->_parser->on('parse.begin', function (XmlElement $stream) { |
|
| 83 | + $this->_parser->on('parse.begin', function(XmlElement $stream) { |
|
| 84 | 84 | $this->_stream = $stream; |
| 85 | - $this->emit('stream.open', [ $stream ]); |
|
| 85 | + $this->emit('stream.open', [$stream]); |
|
| 86 | 86 | }, with\all(with\tag('stream'), with\xmlns(self::NAMESPACE_URI))); |
| 87 | 87 | |
| 88 | - $this->_parser->on('parse.end', function (XmlElement $stream) { |
|
| 89 | - $this->emit('stream.close', [ $stream ]); |
|
| 88 | + $this->_parser->on('parse.end', function(XmlElement $stream) { |
|
| 89 | + $this->emit('stream.close', [$stream]); |
|
| 90 | 90 | $this->_stream = null; |
| 91 | 91 | }, with\all(with\tag('stream'), with\xmlns(self::NAMESPACE_URI))); |
| 92 | 92 | |
| 93 | 93 | $this->on('data', [$this->_parser, 'parse']); |
| 94 | - $this->_parser->on('element', function (...$arguments) { |
|
| 94 | + $this->_parser->on('element', function(...$arguments) { |
|
| 95 | 95 | $this->emit('element', $arguments); |
| 96 | 96 | }); |
| 97 | - $this->on('close', function () { $this->_isOpened = false; }); |
|
| 97 | + $this->on('close', function() { $this->_isOpened = false; }); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function write($data) |
| 108 | 108 | { |
| 109 | - $this->emit('send.'.($data instanceof XmlElement ? 'element' : 'text'), [ $data ]); |
|
| 109 | + $this->emit('send.' . ($data instanceof XmlElement ? 'element' : 'text'), [$data]); |
|
| 110 | 110 | |
| 111 | 111 | return parent::write($data); |
| 112 | 112 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | private function handleError(Error $element) |
| 173 | 173 | { |
| 174 | - if ($this->emit('stream.error', [ $element ])) { |
|
| 174 | + if ($this->emit('stream.error', [$element])) { |
|
| 175 | 175 | throw new StreamErrorException($element); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $console = Console::get(); |
| 74 | 74 | |
| 75 | - $result = $console->styled(['color' => 'yellow'], 'array').' with '.$console->styled(['color' => 'magenta'], count($array)).' elements:'.PHP_EOL; |
|
| 75 | + $result = $console->styled(['color' => 'yellow'], 'array') . ' with ' . $console->styled(['color' => 'magenta'], count($array)) . ' elements:' . PHP_EOL; |
|
| 76 | 76 | foreach ($array as $key => $value) { |
| 77 | - $result .= "\t".str_replace("\n", "\n\t", '['.$this->dump($key).']: '.$this->dump($value)).PHP_EOL; |
|
| 77 | + $result .= "\t" . str_replace("\n", "\n\t", '[' . $this->dump($key) . ']: ' . $this->dump($value)) . PHP_EOL; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $result; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public function init() |
| 84 | 84 | { |
| 85 | - $this->register('array', [$this, '_dumpArray']); |
|
| 85 | + $this->register('array', [$this, '_dumpArray']); |
|
| 86 | 86 | $this->register('object', [$this, '_dumpObject']); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | { |
| 108 | 108 | foreach ($events as $event) { |
| 109 | 109 | if (!isset($this->_redirectors[$event])) { |
| 110 | - $this->_redirectors[$event] = function (...$arguments) use ($event) { |
|
| 110 | + $this->_redirectors[$event] = function(...$arguments) use ($event) { |
|
| 111 | 111 | $this->emit($event, $arguments); |
| 112 | 112 | }; |
| 113 | 113 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function remove($value) |
| 63 | 63 | { |
| 64 | - $this->_collection = array_filter($this->_collection, function ($e) use ($value) { |
|
| 64 | + $this->_collection = array_filter($this->_collection, function($e) use ($value) { |
|
| 65 | 65 | return $e[1] !== $value; |
| 66 | 66 | }); |
| 67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | private function rebuildCache() |
| 72 | 72 | { |
| 73 | - usort($this->_collection, function ($a, $b) { |
|
| 73 | + usort($this->_collection, function($a, $b) { |
|
| 74 | 74 | return $b[0] <=> $a[0]; |
| 75 | 75 | }); |
| 76 | 76 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | function typeof($value) : string |
| 27 | 27 | { |
| 28 | 28 | if (is_object($value)) { |
| 29 | - return "object of type ".get_class($value); |
|
| 29 | + return "object of type " . get_class($value); |
|
| 30 | 30 | } elseif (is_resource($value)) { |
| 31 | - return get_resource_type($value).' resource'; |
|
| 31 | + return get_resource_type($value) . ' resource'; |
|
| 32 | 32 | } else { |
| 33 | 33 | return gettype($value); |
| 34 | 34 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | function partial(callable $callable, $argument, int $position = 0) : callable |
| 38 | 38 | { |
| 39 | - return function (...$arguments) use ($callable, $argument, $position) { |
|
| 39 | + return function(...$arguments) use ($callable, $argument, $position) { |
|
| 40 | 40 | $arguments = array_merge( |
| 41 | 41 | array_slice($arguments, 0, $position), |
| 42 | - [ $argument ], |
|
| 42 | + [$argument], |
|
| 43 | 43 | array_slice($arguments, $position) |
| 44 | 44 | ); |
| 45 | 45 | |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | function dd($value) |
| 51 | 51 | { |
| 52 | - echo Dumper::get()->dump($value).PHP_EOL.PHP_EOL; |
|
| 52 | + echo Dumper::get()->dump($value) . PHP_EOL . PHP_EOL; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | function format($string, array $arguments = []) |
| 56 | 56 | { |
| 57 | - return str_replace(array_map(function ($e) { return "{{$e}}"; }, array_keys($arguments)), $arguments, $string); |
|
| 57 | + return str_replace(array_map(function($e) { return "{{$e}}"; }, array_keys($arguments)), $arguments, $string); |
|
| 58 | 58 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $condition = with\predicate($condition); |
| 85 | 85 | |
| 86 | - return function (...$arguments) use ($listener, $condition) { |
|
| 86 | + return function(...$arguments) use ($listener, $condition) { |
|
| 87 | 87 | if ($condition(...$arguments)) { |
| 88 | 88 | $listener(...$arguments); |
| 89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | private function getOnceCallable(callable $listener, $event) : callable |
| 94 | 94 | { |
| 95 | - return $onceListener = function (...$arguments) use (&$onceListener, $event, $listener) { |
|
| 95 | + return $onceListener = function(...$arguments) use (&$onceListener, $event, $listener) { |
|
| 96 | 96 | $this->removeListener($event, $onceListener); |
| 97 | 97 | |
| 98 | 98 | $listener(...$arguments); |