Completed
Push — master ( f4b721...596cf5 )
by Kacper
02:42
created
Utils/Dumper.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Utils/DnsResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Utils/Helper.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = [])
Please login to merge, or discard this patch.
XmppClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Xml/XmlElement.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 
89 89
     public function xml($clean = true): string
90 90
     {
91
-        if($this->namespace && $this->_prefix === null) {
91
+        if ($this->namespace && $this->_prefix === null) {
92 92
             $this->_prefix = $this->lookupPrefix($this->namespace);
93 93
         }
94 94
 
95 95
         $attributes = $this->attributes();
96 96
 
97 97
         $result = "<{$this->name}";
98
-        $result .= ' '.implode(' ', array_map(function($key, $value) {
99
-            return $key.'="'.htmlspecialchars($value, ENT_QUOTES).'"';
98
+        $result .= ' ' . implode(' ', array_map(function($key, $value) {
99
+            return $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"';
100 100
         }, array_keys($attributes), array_values($attributes)));
101 101
 
102
-        if(!empty($this->_children)) {
102
+        if (!empty($this->_children)) {
103 103
             $result .= ">{$this->innerXml}</{$this->name}>";
104 104
         } else {
105 105
             $result .= "/>";
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function getInnerXml()
112 112
     {
113 113
         return implode('', array_map(function($element) {
114
-            if(is_string($element)) {
114
+            if (is_string($element)) {
115 115
                 return htmlspecialchars($element);
116 116
             } elseif ($element instanceof XmlElement) {
117 117
                 return $element->xml(false);
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 
124 124
     public function setAttribute(string $attribute, $value, string $uri = null)
125 125
     {
126
-        if($uri === 'http://www.w3.org/2000/xmlns/') {
126
+        if ($uri === 'http://www.w3.org/2000/xmlns/') {
127 127
             $this->setNamespace($value, $attribute);
128 128
             return;
129 129
         }
130 130
 
131
-        if($uri !== null) {
131
+        if ($uri !== null) {
132 132
             $attribute = $this->_prefix($attribute, $uri);
133 133
         }
134 134
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
     public function getAttribute(string $attribute, string $uri = null)
139 139
     {
140
-        if($uri !== null) {
140
+        if ($uri !== null) {
141 141
             $attribute = $this->_prefix($attribute, $uri);
142 142
         }
143 143
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function getNamespaces($parent = true): array
156 156
     {
157
-        if(!$this->_parent) {
157
+        if (!$this->_parent) {
158 158
             return $this->_namespaces;
159 159
         }
160 160
 
161
-        if($parent) {
161
+        if ($parent) {
162 162
             return array_merge($this->_namespaces, $this->_parent->getNamespaces());
163 163
         } else {
164 164
             return array_diff_assoc($this->_namespaces, $this->_parent->getNamespaces());
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $namespaces = $this->getNamespaces(false);
171 171
         $namespaces = array_map(function($prefix, $uri) {
172
-            return [ $prefix ? "xmlns:{$prefix}" : 'xmlns', $uri ];
172
+            return [$prefix ? "xmlns:{$prefix}" : 'xmlns', $uri];
173 173
         }, array_values($namespaces), array_keys($namespaces));
174 174
 
175 175
         return array_merge(
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function setNamespace(string $uri, $prefix = false)
196 196
     {
197
-        if($prefix === false) {
197
+        if ($prefix === false) {
198 198
             $prefix = $this->_prefix;
199 199
         }
200 200
 
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 
214 214
     public function append($element)
215 215
     {
216
-        if(!is_string($element) && !$element instanceof XmlElement) {
216
+        if (!is_string($element) && !$element instanceof XmlElement) {
217 217
             throw new InvalidArgumentException(helper\format('$element should be either string or object of {class} class, {type} given', [
218 218
                 'class' => XmlElement::class,
219 219
                 'type'  => helper\typeof($element)
220 220
             ]));
221 221
         }
222 222
 
223
-        if($element instanceof XmlElement) {
224
-            $element->parent  = $this;
223
+        if ($element instanceof XmlElement) {
224
+            $element->parent = $this;
225 225
         }
226 226
 
227 227
         return $this->_children[] = $element;
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     public function getName()
231 231
     {
232
-        return ($this->_prefix ? $this->prefix.':' : null).$this->localName;
232
+        return ($this->_prefix ? $this->prefix . ':' : null) . $this->localName;
233 233
     }
234 234
 
235 235
     public function getPrefix()
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
 
245 245
     protected function setParent(XmlElement $parent)
246 246
     {
247
-        if(!$this->_prefix && ($prefix = $parent->lookupPrefix($this->namespace)) !== false) {
247
+        if (!$this->_prefix && ($prefix = $parent->lookupPrefix($this->namespace)) !== false) {
248 248
             $this->_namespaces[$this->namespace] = $prefix;
249 249
             $this->_prefix = $prefix;
250 250
         }
251 251
 
252 252
         $this->_parent = $parent;
253
-        if($this->namespace === false) {
253
+        if ($this->namespace === false) {
254 254
             $this->namespace = $parent->namespace;
255 255
         }
256 256
 
257
-        if(!$this->_prefix) {
257
+        if (!$this->_prefix) {
258 258
             $this->_prefix = $this->lookupPrefix($this->namespace);
259 259
         }
260 260
     }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     public function elements($name, $uri = null) : array
271 271
     {
272 272
         $predicate = filter\tag($name);
273
-        if($uri !== null) {
273
+        if ($uri !== null) {
274 274
             $predicate = filter\all($predicate, filter\xmlns($uri));
275 275
         }
276 276
 
Please login to merge, or discard this patch.