Passed
Pull Request — master (#12)
by Jake
02:34
created
src/CSS/QueryPathEventHandler.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -254,11 +254,11 @@  discard block
 block discarded – undo
254 254
 				$found->attach($item);
255 255
 			}
256 256
 
257
-			if (! empty($nsuri)) {
257
+			if (!empty($nsuri)) {
258 258
 				$nl = $item->getElementsByTagNameNS($nsuri, $lname);
259 259
 				// If something is found, merge them:
260 260
 				//if (!empty($nl)) $found = array_merge($found, $this->nodeListToArray($nl));
261
-				if (! empty($nl)) {
261
+				if (!empty($nl)) {
262 262
 					$this->attachNodeList($nl, $found);
263 263
 				}
264 264
 			} else {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		//$this->findAnyElement = TRUE;
302 302
 		$nsuri = $this->dom->lookupNamespaceURI($ns);
303 303
 		$found = new SplObjectStorage();
304
-		if (! empty($nsuri)) {
304
+		if (!empty($nsuri)) {
305 305
 			$matches = $this->candidateList();
306 306
 			foreach ($matches as $item) {
307 307
 				if ($item instanceof DOMNode && $nsuri == $item->namespaceURI) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 		}
312
-		$this->matches        = $found;//UniqueElementList::get($found);
312
+		$this->matches        = $found; //UniqueElementList::get($found);
313 313
 		$this->findAnyElement = false;
314 314
 	}
315 315
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			}
328 328
 		}
329 329
 
330
-		$this->matches        = $found;//UniqueElementList::get($found);
330
+		$this->matches        = $found; //UniqueElementList::get($found);
331 331
 		$this->findAnyElement = false;
332 332
 	}
333 333
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			break;
440 440
 			case 'lang':
441 441
 				// No value = exception.
442
-				if (! isset($value)) {
442
+				if (!isset($value)) {
443 443
 					throw new NotImplementedException("No handler for lang pseudoclass without value.");
444 444
 				}
445 445
 				$this->lang($value);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 				$matches = $this->candidateList();
544 544
 				$found   = new SplObjectStorage();
545 545
 				foreach ($matches as $match) {
546
-					if (! empty($match->firstChild)) {
546
+					if (!empty($match->firstChild)) {
547 547
 						$found->attach($match);
548 548
 					}
549 549
 				}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		} elseif ($rule == 'n') {
727 727
 			return [1, 0];
728 728
 		} elseif (is_numeric($rule)) {
729
-			return [0, (int) $rule];
729
+			return [0, (int)$rule];
730 730
 		}
731 731
 
732 732
 		$rule = explode('n', $rule);
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
 
737 737
 		// Each of these is legal: 1, -1, and -. '-' is shorthand for -1.
738 738
 		$aVal = trim($rule[0]);
739
-		$aVal = ($aVal == '-') ? -1 : (int) $aVal;
739
+		$aVal = ($aVal == '-') ? -1 : (int)$aVal;
740 740
 
741
-		$bVal = ! empty($rule[1]) ? (int) trim($rule[1]) : 0;
741
+		$bVal = !empty($rule[1]) ? (int)trim($rule[1]) : 0;
742 742
 
743 743
 		return [$aVal, $bVal];
744 744
 	}
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
 			// Build up an array of all of children of this parent, and store the
770 770
 			// index of each element for reference later. We only need to do this
771 771
 			// once per parent, though.
772
-			if (! $parents->contains($parent)) {
772
+			if (!$parents->contains($parent)) {
773 773
 				$c = 0;
774 774
 				foreach ($parent->childNodes as $child) {
775 775
 					// We only want nodes, and if this call is preceded by an element
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 			// Build up an array of all of children of this parent, and store the
963 963
 			// index of each element for reference later. We only need to do this
964 964
 			// once per parent, though.
965
-			if (! $parents->contains($parent)) {
965
+			if (!$parents->contains($parent)) {
966 966
 				$c = 0;
967 967
 				foreach ($parent->childNodes as $child) {
968 968
 					// This doesn't totally make sense, since the CSS 3 spec does not require that
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 			$parent = $item->parentNode;
1112 1112
 			foreach ($parent->childNodes as $kid) {
1113 1113
 				if ($kid->nodeType == XML_ELEMENT_NODE && $kid->tagName == $type) {
1114
-					if (! $found->contains($kid)) {
1114
+					if (!$found->contains($kid)) {
1115 1115
 						$found->attach($kid);
1116 1116
 					}
1117 1117
 					break;
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			for ($i = $parent->childNodes->length - 1; $i >= 0; --$i) {
1135 1135
 				$kid = $parent->childNodes->item($i);
1136 1136
 				if ($kid->nodeType == XML_ELEMENT_NODE && $kid->tagName == $type) {
1137
-					if (! $found->contains($kid)) {
1137
+					if (!$found->contains($kid)) {
1138 1138
 						$found->attach($kid);
1139 1139
 					}
1140 1140
 					break;
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		$matches = $this->candidateList();
1201 1201
 		$found   = new SplObjectStorage();
1202 1202
 		foreach ($matches as $item) {
1203
-			if (! $item->parentNode) {
1203
+			if (!$item->parentNode) {
1204 1204
 				$this->matches = new SplObjectStorage();
1205 1205
 			}
1206 1206
 			$parent     = $item->parentNode;
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
 				foreach ($matches as $item) {
1277 1277
 					$str   = $item->textContent;
1278 1278
 					$lines = explode("\n", $str);
1279
-					if (! empty($lines)) {
1279
+					if (!empty($lines)) {
1280 1280
 						$line = trim($lines[0]);
1281
-						if (! empty($line)) {
1281
+						if (!empty($line)) {
1282 1282
 							$o->textContent = $line;
1283
-							$found->attach($o);//trim($lines[0]);
1283
+							$found->attach($o); //trim($lines[0]);
1284 1284
 						}
1285 1285
 					}
1286 1286
 				}
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 				$o       = new stdClass();
1295 1295
 				foreach ($matches as $item) {
1296 1296
 					$str = $item->textContent;
1297
-					if (! empty($str)) {
1297
+					if (!empty($str)) {
1298 1298
 						$str            = substr($str, 0, 1);
1299 1299
 						$o->textContent = $str;
1300 1300
 						$found->attach($o);
Please login to merge, or discard this patch.
src/CSS/DOMTraverser.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 			$splos->rewind();
89 89
 			$first = $splos->current();
90 90
 			if ($first instanceof DOMDocument) {
91
-				$this->dom = $first;//->documentElement;
91
+				$this->dom = $first; //->documentElement;
92 92
 			} else {
93
-				$this->dom = $first->ownerDocument;//->documentElement;
93
+				$this->dom = $first->ownerDocument; //->documentElement;
94 94
 			}
95 95
 
96 96
 			$this->scopeNode = $scopeNode;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function combineAdjacent($node, $selectors, $index)
299 299
 	{
300
-		while (! empty($node->previousSibling)) {
300
+		while (!empty($node->previousSibling)) {
301 301
 			$node = $node->previousSibling;
302 302
 			if ($node->nodeType == XML_ELEMENT_NODE) {
303 303
 				//$this->debug(sprintf('Testing %s against "%s"', $node->tagName, $selectors[$index]));
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function combineSibling($node, $selectors, $index)
329 329
 	{
330
-		while (! empty($node->previousSibling)) {
330
+		while (!empty($node->previousSibling)) {
331 331
 			$node = $node->previousSibling;
332 332
 			if ($node->nodeType == XML_ELEMENT_NODE && $this->matchesSimpleSelector($node, $selectors, $index)) {
333 333
 				return true;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public function combineAnyDescendant($node, $selectors, $index)
385 385
 	{
386
-		while (! empty($node->parentNode)) {
386
+		while (!empty($node->parentNode)) {
387 387
 			$node = $node->parentNode;
388 388
 
389 389
 			// Catch case where element is child of something
@@ -429,16 +429,16 @@  discard block
 block discarded – undo
429 429
 		// this should give us only a single matched element
430 430
 		// to work with.
431 431
 		if (/*$element == '*' &&*/
432
-		! empty($selector->id)) {
432
+		!empty($selector->id)) {
433 433
 			$initialMatches = $this->initialMatchOnID($selector, $matches);
434 434
 		} // If a namespace is set, find the namespace matches.
435
-		elseif (! empty($selector->ns)) {
435
+		elseif (!empty($selector->ns)) {
436 436
 			$initialMatches = $this->initialMatchOnElementNS($selector, $matches);
437 437
 		}
438 438
 		// If the element is a wildcard, using class can
439 439
 		// substantially reduce the number of elements that
440 440
 		// we start with.
441
-		elseif ($element === '*' && ! empty($selector->classes)) {
441
+		elseif ($element === '*' && !empty($selector->classes)) {
442 442
 			$initialMatches = $this->initialMatchOnClasses($selector, $matches);
443 443
 		} else {
444 444
 			$initialMatches = $this->initialMatchOnElement($selector, $matches);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
 		// Issue #145: DOMXPath will through an exception if the DOM is
469 469
 		// not set.
470
-		if (! ($this->dom instanceof DOMDocument)) {
470
+		if (!($this->dom instanceof DOMDocument)) {
471 471
 			return $found;
472 472
 		}
473 473
 		$baseQuery = ".//*[@id='{$id}']";
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			}
482 482
 
483 483
 			$nl = $this->initialXpathQuery($xpath, $node, $baseQuery);
484
-			if (! empty($nl) && $nl instanceof DOMNodeList) {
484
+			if (!empty($nl) && $nl instanceof DOMNodeList) {
485 485
 				$this->attachNodeList($nl, $found);
486 486
 			}
487 487
 		}
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
 		// Issue #145: DOMXPath will through an exception if the DOM is
513 513
 		// not set.
514
-		if (! ($this->dom instanceof DOMDocument)) {
514
+		if (!($this->dom instanceof DOMDocument)) {
515 515
 			return $found;
516 516
 		}
517 517
 		$baseQuery = './/*[@class]';
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 				$found->attach($node);
594 594
 			}
595 595
 			$nl = $node->getElementsByTagName($element);
596
-			if (! empty($nl) && $nl instanceof DOMNodeList) {
596
+			if (!empty($nl) && $nl instanceof DOMNodeList) {
597 597
 				$this->attachNodeList($nl, $found);
598 598
 			}
599 599
 		}
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		}
665 665
 
666 666
 		// Handle namespace.
667
-		if (! empty($ns) && $ns !== '*') {
667
+		if (!empty($ns) && $ns !== '*') {
668 668
 			// Check whether we have a matching NS URI.
669 669
 			$nsuri = $node->lookupNamespaceURI($ns);
670 670
 			if (empty($nsuri) || $node->namespaceURI !== $nsuri) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			// Namespaced attributes.
727 727
 			if (isset($attr['ns']) && $attr['ns'] !== '*') {
728 728
 				$nsuri = $node->lookupNamespaceURI($attr['ns']);
729
-				if (empty($nsuri) || ! $node->hasAttributeNS($nsuri, $attr['name'])) {
729
+				if (empty($nsuri) || !$node->hasAttributeNS($nsuri, $attr['name'])) {
730 730
 					return false;
731 731
 				}
732 732
 				$matches = Util::matchesAttributeNS($node, $attr['name'], $nsuri, $val, $attr['op']);
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 				$matches = Util::matchesAttribute($node, $attr['name'], $val, $attr['op']);
747 747
 			}
748 748
 
749
-			if (! $matches) {
749
+			if (!$matches) {
750 750
 				return false;
751 751
 			}
752 752
 		}
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			return true;
786 786
 		}
787 787
 
788
-		if (! $node->hasAttribute('class')) {
788
+		if (!$node->hasAttribute('class')) {
789 789
 			return false;
790 790
 		}
791 791
 
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 			$name = $pseudoClass['name'];
816 816
 			// Avoid E_STRICT violation.
817 817
 			$value = $pseudoClass['value'] ?? null;
818
-			$ret   &= $this->psHandler->elementMatches($name, $node, $this->scopeNode, $value);
818
+			$ret &= $this->psHandler->elementMatches($name, $node, $this->scopeNode, $value);
819 819
 		}
820 820
 
821 821
 		return $ret;
Please login to merge, or discard this patch.
src/CSS/InputStream.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	public function consume()
49 49
 	{
50 50
 		$ret = array_shift($this->stream);
51
-		if (! empty($ret)) {
51
+		if (!empty($ret)) {
52 52
 			$this->position++;
53 53
 		}
54 54
 
Please login to merge, or discard this patch.
src/Helpers/QueryMutators.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 					$vals = array_filter(explode(' ', $m->getAttribute('class')));
662 662
 					$buf  = [];
663 663
 					foreach ($vals as $v) {
664
-						if (! in_array($v, $to_remove)) {
664
+						if (!in_array($v, $to_remove)) {
665 665
 							$buf[] = $v;
666 666
 						}
667 667
 					}
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 	 */
796 796
 	public function remove($selector = null): Query
797 797
 	{
798
-		if (! empty($selector)) {
798
+		if (!empty($selector)) {
799 799
 			// Do a non-destructive find.
800 800
 			$query = new QueryPathEventHandler($this->matches);
801 801
 			$query->find($selector);
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		$css = [];
1042 1042
 		foreach ($this->matches as $match) {
1043 1043
 			$style = $match->getAttribute('style');
1044
-			if (! empty($style)) {
1044
+			if (!empty($style)) {
1045 1045
 				// XXX: Is this sufficient?
1046 1046
 				$style_array = explode(';', $style);
1047 1047
 				foreach ($style_array as $item) {
Please login to merge, or discard this patch.
src/Helpers/QueryChecks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 				// pass an is() on [a, b, c, d]. We use the $seen SPLOS to prevent this.
53 53
 				$seen = new SplObjectStorage();
54 54
 				foreach ($selector as $item) {
55
-					if (! $this->matches->contains($item) || $seen->contains($item)) {
55
+					if (!$this->matches->contains($item) || $seen->contains($item)) {
56 56
 						return false;
57 57
 					}
58 58
 					$seen->attach($item);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		// ones we add to our new matches.
114 114
 		foreach ($nodes as $original_node) {
115 115
 			$node = $original_node;
116
-			while (! empty($node)/* && $node != $node->ownerDocument*/) {
116
+			while (!empty($node)/* && $node != $node->ownerDocument*/) {
117 117
 				if ($this->matches->contains($node)) {
118 118
 					$found->attach($node);
119 119
 				}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	public function hasAttr($attrName): bool
168 168
 	{
169 169
 		foreach ($this->matches as $match) {
170
-			if (! $match->hasAttribute($attrName)) {
170
+			if (!$match->hasAttribute($attrName)) {
171 171
 				return false;
172 172
 			}
173 173
 		}
Please login to merge, or discard this patch.
src/Helpers/QueryFilters.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 				if (isset($c)) {
246 246
 					if (is_array($c) || $c instanceof Iterable) {
247 247
 						foreach ($c as $retval) {
248
-							if (! is_object($retval)) {
248
+							if (!is_object($retval)) {
249 249
 								$tmp              = new stdClass();
250 250
 								$tmp->textContent = $retval;
251 251
 								$retval           = $tmp;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 							$found->attach($retval);
254 254
 						}
255 255
 					} else {
256
-						if (! is_object($c)) {
256
+						if (!is_object($c)) {
257 257
 							$tmp              = new stdClass();
258 258
 							$tmp->textContent = $c;
259 259
 							$c                = $tmp;
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 				$m = $m->parentNode;
654 654
 				// Is there any case where parent node is not an element?
655 655
 				if ($m->nodeType === XML_ELEMENT_NODE) {
656
-					if (! empty($selector)) {
656
+					if (!empty($selector)) {
657 657
 						if (QueryPath::with($m, null, $this->options)->is($selector) > 0) {
658 658
 							break;
659 659
 						}
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 			}
715 715
 		} elseif (is_array($selector)) {
716 716
 			foreach ($this->matches as $m) {
717
-				if (! in_array($m, $selector, true)) {
717
+				if (!in_array($m, $selector, true)) {
718 718
 					$found->attach($m);
719 719
 				}
720 720
 			}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 			}
727 727
 		} else {
728 728
 			foreach ($this->matches as $m) {
729
-				if (! QueryPath::with($m, null, $this->options)->is($selector)) {
729
+				if (!QueryPath::with($m, null, $this->options)->is($selector)) {
730 730
 					$found->attach($m);
731 731
 				}
732 732
 			}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 				$m = $m->parentNode;
803 803
 				// Is there any case where parent node is not an element?
804 804
 				if ($m->nodeType === XML_ELEMENT_NODE) {
805
-					if (! empty($selector)) {
805
+					if (!empty($selector)) {
806 806
 						if (QueryPath::with($m, null, $this->options)->is($selector) > 0) {
807 807
 							$found->attach($m);
808 808
 							break;
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 				$m = $m->parentNode;
843 843
 				// Is there any case where parent node is not an element?
844 844
 				if ($m->nodeType === XML_ELEMENT_NODE) {
845
-					if (! empty($selector)) {
845
+					if (!empty($selector)) {
846 846
 						if (QueryPath::with($m, null, $this->options)->is($selector) > 0) {
847 847
 							$found->attach($m);
848 848
 						}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			while (isset($m->nextSibling)) {
883 883
 				$m = $m->nextSibling;
884 884
 				if ($m->nodeType === XML_ELEMENT_NODE) {
885
-					if (! empty($selector)) {
885
+					if (!empty($selector)) {
886 886
 						if (QueryPath::with($m, null, $this->options)->is($selector) > 0) {
887 887
 							$found->attach($m);
888 888
 							break;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 			while (isset($m->nextSibling)) {
925 925
 				$m = $m->nextSibling;
926 926
 				if ($m->nodeType === XML_ELEMENT_NODE) {
927
-					if (! empty($selector)) {
927
+					if (!empty($selector)) {
928 928
 						if (QueryPath::with($m, null, $this->options)->is($selector) > 0) {
929 929
 							$found->attach($m);
930 930
 						}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 			while (isset($m->previousSibling)) {
966 966
 				$m = $m->previousSibling;
967 967
 				if ($m->nodeType === XML_ELEMENT_NODE) {
968
-					if (! empty($selector)) {
968
+					if (!empty($selector)) {
969 969
 						if (QueryPath::with($m, null, $this->options)->is($selector)) {
970 970
 							$found->attach($m);
971 971
 							break;
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 			while (isset($m->previousSibling)) {
1008 1008
 				$m = $m->previousSibling;
1009 1009
 				if ($m->nodeType === XML_ELEMENT_NODE) {
1010
-					if (! empty($selector)) {
1010
+					if (!empty($selector)) {
1011 1011
 						if (QueryPath::with($m, null, $this->options)->is($selector)) {
1012 1012
 							$found->attach($m);
1013 1013
 						}
Please login to merge, or discard this patch.
src/IOException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
 	public static function initializeFromError($errno, $errstr, $errfile, $errline, $context = null)
19 19
 	{
20 20
 		$class = __CLASS__;
21
-		throw new $class($errno, (int) $errstr, $errfile, $errline);
21
+		throw new $class($errno, (int)$errstr, $errfile, $errline);
22 22
 	}
23 23
 }
Please login to merge, or discard this patch.
src/ParseException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,6 +45,6 @@
 block discarded – undo
45 45
 	public static function initializeFromError($errno, $errstr, $errfile, $errline, $context = null)
46 46
 	{
47 47
 		$class = __CLASS__;
48
-		throw new $class($errno, (int) $errstr, $errfile, $errline);
48
+		throw new $class($errno, (int)$errstr, $errfile, $errline);
49 49
 	}
50 50
 }
Please login to merge, or discard this patch.
examples/docx.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
 
89 89
 function readZippedXML($archiveFile, $dataFile)
90 90
 {
91
-	if (! class_exists('ZipArchive', false)) {
91
+	if (!class_exists('ZipArchive', false)) {
92 92
 		return "ZipArchive Class Doesn't Exist.";
93 93
 	}
94 94
 	// Create new ZIP archive
Please login to merge, or discard this patch.