@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * XMPP Library |
| 4 | 4 | * |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function __construct(DuplexStreamInterface $decorated = null) |
| 38 | 38 | { |
| 39 | - if($decorated !== null) { |
|
| 39 | + if ($decorated !== null) { |
|
| 40 | 40 | $this->exchangeStream($decorated); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | static $events = ['data', 'end', 'drain', 'error', 'close', 'pipe']; |
| 87 | 87 | |
| 88 | - if($this->_decorated !== null) { |
|
| 88 | + if ($this->_decorated !== null) { |
|
| 89 | 89 | $this->unsubscribe($this->_decorated, $events); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | private function unsubscribe(DuplexStreamInterface $stream, array $events) |
| 97 | 97 | { |
| 98 | 98 | foreach ($events as $event) { |
| 99 | - if(!isset($this->_redirectors[$event])) { |
|
| 99 | + if (!isset($this->_redirectors[$event])) { |
|
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | private function subscribe(DuplexStreamInterface $stream, array $events) |
| 108 | 108 | { |
| 109 | 109 | foreach ($events as $event) { |
| 110 | - if(!isset($this->_redirectors[$event])) { |
|
| 111 | - $this->_redirectors[$event] = function (...$arguments) use ($event) { |
|
| 110 | + if (!isset($this->_redirectors[$event])) { |
|
| 111 | + $this->_redirectors[$event] = function(...$arguments) use ($event) { |
|
| 112 | 112 | $this->emit($event, $arguments); |
| 113 | 113 | }; |
| 114 | 114 | } |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | private function getDumper($value) |
| 39 | 39 | { |
| 40 | - if(is_object($value)) { |
|
| 40 | + if (is_object($value)) { |
|
| 41 | 41 | $class = get_class($value); |
| 42 | 42 | foreach (array_merge([$class], class_parents($class), class_implements($class)) as $class) { |
| 43 | - if(isset($this->_dumpers[$class])) { |
|
| 43 | + if (isset($this->_dumpers[$class])) { |
|
| 44 | 44 | return $this->_dumpers[$class]; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if(isset($this->_dumpers[gettype($value)])) { |
|
| 49 | + if (isset($this->_dumpers[gettype($value)])) { |
|
| 50 | 50 | return $this->_dumpers[gettype($value)]; |
| 51 | 51 | } |
| 52 | 52 | |
@@ -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; |
|
| 76 | - foreach($array as $key => $value) { |
|
| 77 | - $result .= "\t".str_replace("\n", "\n\t", '['.$this->dump($key).']: '.$this->dump($value)).PHP_EOL; |
|
| 75 | + $result = $console->styled(['color' => 'yellow'], 'array') . ' with ' . $console->styled(['color' => 'magenta'], count($array)) . ' elements:' . PHP_EOL; |
|
| 76 | + foreach ($array as $key => $value) { |
|
| 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 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $this->_results = array_merge($this->_results, array_map(function ($record) { |
|
| 57 | + $this->_results = array_merge($this->_results, array_map(function($record) { |
|
| 58 | 58 | return [$record['target'], $record['port']]; |
| 59 | 59 | }, $result)); |
| 60 | 60 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function typeof($value) : string |
| 26 | 26 | { |
| 27 | - if(is_object($value)) { |
|
| 28 | - return "object of type ".get_class($value); |
|
| 29 | - } elseif(is_resource($value)) { |
|
| 30 | - return get_resource_type($value).' resource'; |
|
| 27 | + if (is_object($value)) { |
|
| 28 | + return "object of type " . get_class($value); |
|
| 29 | + } elseif (is_resource($value)) { |
|
| 30 | + return get_resource_type($value) . ' resource'; |
|
| 31 | 31 | } else { |
| 32 | 32 | return gettype($value); |
| 33 | 33 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | return function(...$arguments) use ($callable, $argument, $position) { |
| 39 | 39 | $arguments = array_merge( |
| 40 | 40 | array_slice($arguments, 0, $position), |
| 41 | - [ $argument ], |
|
| 41 | + [$argument], |
|
| 42 | 42 | array_slice($arguments, $position) |
| 43 | 43 | ); |
| 44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | function dd($value) |
| 50 | 50 | { |
| 51 | - echo Dumper::get()->dump($value).PHP_EOL.PHP_EOL; |
|
| 51 | + echo Dumper::get()->dump($value) . PHP_EOL . PHP_EOL; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function format($string, array $arguments = []) |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | protected function handleFeatures(Features $element) |
| 108 | 108 | { |
| 109 | - if(!parent::handleFeatures($element)) { |
|
| 109 | + if (!parent::handleFeatures($element)) { |
|
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |