Test Setup Failed
Branch master (46a5be)
by Kacper
05:10
created
Utils/BetterEmitter.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -48,6 +48,9 @@
 block discarded – undo
48 48
         return true;
49 49
     }
50 50
 
51
+    /**
52
+     * @param string $event
53
+     */
51 54
     public function emit($event, array $arguments = [])
52 55
     {
53 56
         foreach ($this->listeners($event) as $listener) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function removeListener($event, callable $listener)
42 42
     {
43
-        if(!isset($this->listeners[$event])) {
43
+        if (!isset($this->listeners[$event])) {
44 44
             return false;
45 45
         }
46 46
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     private function addListener($event, callable $listener, int $priority = 0)
68 68
     {
69
-        if(!isset($this->listeners[$event])) {
69
+        if (!isset($this->listeners[$event])) {
70 70
             $this->listeners[$event] = new PriorityCollection();
71 71
         }
72 72
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         }
81 81
 
82 82
         $condition = $this->emitterResolveCondition($condition);
83
-        return function (...$arguments) use ($listener, $condition) {
83
+        return function(...$arguments) use ($listener, $condition) {
84 84
             if ($condition(...$arguments)) {
85 85
                 $listener(...$arguments);
86 86
             }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
     private function getOnceCallable(callable $listener, $event) : callable
91 91
     {
92
-        return $onceListener = function (...$arguments) use (&$onceListener, $event, $listener) {
92
+        return $onceListener = function(...$arguments) use (&$onceListener, $event, $listener) {
93 93
             $this->removeListener($event, $onceListener);
94 94
 
95 95
             $listener(...$arguments);
Please login to merge, or discard this patch.
Xml/XmlElement.php 1 patch
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
  */
21 21
 class XmlElement extends \DOMElement
22 22
 {
23
-    /** @return static */
23
+    /** @param string $uri
24
+/** @return static */
24 25
     public static function create($name = 'element', $content = null, $uri = null)
25 26
     {
26 27
         return self::_document()->importNode(new static($name, $content, $uri));
Please login to merge, or discard this patch.
Xml/XmlParser.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -126,6 +126,9 @@
 block discarded – undo
126 126
         return [$name, $namespace];
127 127
     }
128 128
 
129
+    /**
130
+     * @param string|null $prefix
131
+     */
129 132
     private function _lookup($prefix, $namespaces)
130 133
     {
131 134
         if ($prefix === 'xmlns') {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
         xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
79 79
         xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
80 80
 
81
-        xml_set_element_handler($this->parser, function ($parser, $name, $attrs) {
81
+        xml_set_element_handler($this->parser, function($parser, $name, $attrs) {
82 82
             $this->handleElementStart($name, $attrs);
83
-        }, function ($parser, $name) {
83
+        }, function($parser, $name) {
84 84
             $this->handleElementEnd();
85 85
         });
86 86
 
87
-        xml_set_character_data_handler($this->parser, function ($parser, $data) {
87
+        xml_set_character_data_handler($this->parser, function($parser, $data) {
88 88
             $this->handleTextData($data);
89 89
         });
90 90
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         if (count($this->stack) > 1) {
160 160
             end($this->stack)->appendChild($element);
161 161
         }
162
-        $this->emit('parse.begin', [ $element ]);
162
+        $this->emit('parse.begin', [$element]);
163 163
 
164 164
         $this->stack[] = $element;
165 165
     }
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
 
173 173
         $element = array_pop($this->stack);
174 174
         if (count($this->stack) == 1) {
175
-            $this->emit('element', [ $element ]);
175
+            $this->emit('element', [$element]);
176 176
         }
177 177
 
178
-        $this->emit('parse.end', [ $element ]);
178
+        $this->emit('parse.end', [$element]);
179 179
     }
180 180
 
181 181
     private function handleTextData($data)
Please login to merge, or discard this patch.
Exception/Protocol/StreamErrorException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
 
41 41
     private function generateMessage(Error $error) : string
42 42
     {
43
-        return 'Stream error: '.str_replace('-', ' ', $error->kind).($error->text ? " ({$error->text})" : null);
43
+        return 'Stream error: ' . str_replace('-', ' ', $error->kind) . ($error->text ? " ({$error->text})" : null);
44 44
     }
45 45
 }
Please login to merge, or discard this patch.
Xml/XmlStream.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
 
76 76
         $this->parser = $parser;
77 77
 
78
-        $this->on('element', function (Error $element) {
78
+        $this->on('element', function(Error $element) {
79 79
             $this->handleError($element);
80 80
         }, with\ofType(Error::class));
81 81
 
82
-        $this->parser->on('parse.begin', function (XmlElement $stream) {
82
+        $this->parser->on('parse.begin', function(XmlElement $stream) {
83 83
             $this->stream = $stream;
84
-            $this->emit('stream.open', [ $stream ]);
84
+            $this->emit('stream.open', [$stream]);
85 85
         }, with\all(with\tag('stream'), with\xmlns(self::NAMESPACE_URI)));
86 86
 
87
-        $this->parser->on('parse.end', function (XmlElement $stream) {
88
-            $this->emit('stream.close', [ $stream ]);
87
+        $this->parser->on('parse.end', function(XmlElement $stream) {
88
+            $this->emit('stream.close', [$stream]);
89 89
             $this->stream = null;
90 90
         }, with\all(with\tag('stream'), with\xmlns(self::NAMESPACE_URI)));
91 91
 
92 92
         $this->on('data', [$this->parser, 'parse']);
93
-        $this->parser->on('element', function (...$arguments) {
93
+        $this->parser->on('element', function(...$arguments) {
94 94
             $this->emit('element', $arguments);
95 95
         });
96
-        $this->on('close', function () { $this->isOpened = false; });
96
+        $this->on('close', function() { $this->isOpened = false; });
97 97
     }
98 98
 
99 99
     /**
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function write($data)
107 107
     {
108
-        $this->emit('send.'.($data instanceof XmlElement ? 'element' : 'text'), [ $data ]);
108
+        $this->emit('send.' . ($data instanceof XmlElement ? 'element' : 'text'), [$data]);
109 109
 
110 110
         return parent::write($data);
111 111
     }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public function close()
137 137
     {
138
-        if($this->isOpened()) {
138
+        if ($this->isOpened()) {
139 139
             $this->write('</stream:stream>');
140 140
             $this->isOpened = false;
141 141
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
     private function handleError(Error $element)
172 172
     {
173
-        if($this->emit('stream.error', [ $element ])) {
173
+        if ($this->emit('stream.error', [$element])) {
174 174
             throw new StreamErrorException($element);
175 175
         }
176 176
 
Please login to merge, or discard this patch.
Utils/Helper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function typeof($value) : string
25 25
 {
26
-    if(is_object($value)) {
27
-        return "object of type ".get_class($value);
28
-    } elseif(is_resource($value)) {
29
-        return get_resource_type($value).' resource';
26
+    if (is_object($value)) {
27
+        return "object of type " . get_class($value);
28
+    } elseif (is_resource($value)) {
29
+        return get_resource_type($value) . ' resource';
30 30
     } else {
31 31
         return gettype($value);
32 32
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     return function(...$arguments) use ($callable, $argument, $position) {
38 38
         $arguments = array_merge(
39 39
             array_slice($arguments, 0, $position),
40
-            [ $argument ],
40
+            [$argument],
41 41
             array_slice($arguments, $position)
42 42
         );
43 43
 
Please login to merge, or discard this patch.
Utils/Filter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 
20 20
 function xmlns($uri)
21 21
 {
22
-    return function (XmlElement $element) use ($uri) {
22
+    return function(XmlElement $element) use ($uri) {
23 23
         return $element->namespaceURI === $uri;
24 24
     };
25 25
 }
26 26
 
27 27
 function tag($name)
28 28
 {
29
-    return function (XmlElement $element) use ($name) {
29
+    return function(XmlElement $element) use ($name) {
30 30
         return $element->localName === $name;
31 31
     };
32 32
 }
33 33
 
34 34
 function ofType($class)
35 35
 {
36
-    return function ($object) use ($class) {
36
+    return function($object) use ($class) {
37 37
         return $object instanceof $class;
38 38
     };
39 39
 }
40 40
 
41 41
 function all(callable ...$functions)
42 42
 {
43
-    return function (...$args) use ($functions) {
43
+    return function(...$args) use ($functions) {
44 44
         foreach ($functions as $function) {
45 45
             if (!$function(...$args)) {
46 46
                 return false;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 function any(callable ...$functions)
55 55
 {
56
-    return function (...$args) use ($functions) {
56
+    return function(...$args) use ($functions) {
57 57
         foreach ($functions as $function) {
58 58
             if ($function(...$args)) {
59 59
                 return true;
Please login to merge, or discard this patch.
Stream/Error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
     public function getText()
41 41
     {
42
-        if($text = $this->query(".//xmpp:text")->with('xmpp', 'urn:ietf:params:xml:ns:xmpp-streams')->query()->item(0)) {
42
+        if ($text = $this->query(".//xmpp:text")->with('xmpp', 'urn:ietf:params:xml:ns:xmpp-streams')->query()->item(0)) {
43 43
             return $text;
44 44
         }
45 45
 
Please login to merge, or discard this patch.
XmppStream.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@
 block discarded – undo
37 37
         parent::__construct($parser, $transport);
38 38
 
39 39
         $this->parser->factory->register(Features::class, self::NAMESPACE_URI, 'features');
40
-        $this->parser->factory->register(Error::class,    self::NAMESPACE_URI, 'error');
40
+        $this->parser->factory->register(Error::class, self::NAMESPACE_URI, 'error');
41 41
 
42 42
         $this->_lang = $lang;
43 43
 
44
-        $this->on('element', function (Features $element) {
44
+        $this->on('element', function(Features $element) {
45 45
             $this->handleFeatures($element);
46 46
         }, Features::class);
47 47
 
48
-        $this->on('element', function (XmlElement $element) {
48
+        $this->on('element', function(XmlElement $element) {
49 49
             $this->handleTls($element);
50 50
         }, with\xmlns(self::TLS_NAMESPACE));
51 51
     }
Please login to merge, or discard this patch.