Passed
Push — master ( e6bf3a...6c6503 )
by Marius
40s
created
src/XmlNodeRecursiveIterator.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@
 block discarded – undo
4 4
 
5 5
 class XmlNodeRecursiveIterator extends \ArrayIterator {
6 6
 
7
-	public function __construct( \DOMNodeList $nodeList ) {
8
-		$queue = $this->addElementsToQueue( [], $nodeList );
9
-		parent::__construct( $queue );
10
-	}
7
+    public function __construct( \DOMNodeList $nodeList ) {
8
+        $queue = $this->addElementsToQueue( [], $nodeList );
9
+        parent::__construct( $queue );
10
+    }
11 11
 
12
-	/**
13
-	 * @param \DOMNode[] $queue
14
-	 * @param \DOMNodeList $nodeList
15
-	 *
16
-	 * @return \DOMNode[] New queue
17
-	 */
18
-	private function addElementsToQueue( array $queue, \DOMNodeList $nodeList ) {
19
-		/** @var \DOMNode $node */
20
-		foreach ( $nodeList as $node ) {
21
-			$queue[] = $node;
22
-			if ( $node->childNodes !== null ) {
23
-				$queue = $this->addElementsToQueue( $queue, $node->childNodes );
24
-			}
25
-		}
12
+    /**
13
+     * @param \DOMNode[] $queue
14
+     * @param \DOMNodeList $nodeList
15
+     *
16
+     * @return \DOMNode[] New queue
17
+     */
18
+    private function addElementsToQueue( array $queue, \DOMNodeList $nodeList ) {
19
+        /** @var \DOMNode $node */
20
+        foreach ( $nodeList as $node ) {
21
+            $queue[] = $node;
22
+            if ( $node->childNodes !== null ) {
23
+                $queue = $this->addElementsToQueue( $queue, $node->childNodes );
24
+            }
25
+        }
26 26
 
27
-		return $queue;
28
-	}
27
+        return $queue;
28
+    }
29 29
 
30 30
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 class XmlNodeRecursiveIterator extends \ArrayIterator {
6 6
 
7
-	public function __construct( \DOMNodeList $nodeList ) {
8
-		$queue = $this->addElementsToQueue( [], $nodeList );
9
-		parent::__construct( $queue );
7
+	public function __construct(\DOMNodeList $nodeList) {
8
+		$queue = $this->addElementsToQueue([], $nodeList);
9
+		parent::__construct($queue);
10 10
 	}
11 11
 
12 12
 	/**
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return \DOMNode[] New queue
17 17
 	 */
18
-	private function addElementsToQueue( array $queue, \DOMNodeList $nodeList ) {
18
+	private function addElementsToQueue(array $queue, \DOMNodeList $nodeList) {
19 19
 		/** @var \DOMNode $node */
20
-		foreach ( $nodeList as $node ) {
20
+		foreach ($nodeList as $node) {
21 21
 			$queue[] = $node;
22
-			if ( $node->childNodes !== null ) {
23
-				$queue = $this->addElementsToQueue( $queue, $node->childNodes );
22
+			if ($node->childNodes !== null) {
23
+				$queue = $this->addElementsToQueue($queue, $node->childNodes);
24 24
 			}
25 25
 		}
26 26
 
Please login to merge, or discard this patch.
src/HtmlMatcher.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -8,99 +8,99 @@
 block discarded – undo
8 8
 
9 9
 class HtmlMatcher extends DiagnosingMatcher {
10 10
 
11
-	/**
12
-	 * @link http://www.xmlsoft.org/html/libxml-xmlerror.html#xmlParserErrors
13
-	 * @link https://github.com/Chronic-Dev/libxml2/blob/683f296a905710ff285c28b8644ef3a3d8be9486/include/libxml/xmlerror.h#L257
14
-	 */
15
-	const XML_UNKNOWN_TAG_ERROR_CODE = 801;
16
-
17
-	/**
18
-	 * @var Matcher
19
-	 */
20
-	private $elementMatcher;
21
-
22
-	/**
23
-	 * @param Matcher $elementMatcher
24
-	 *
25
-	 * @return self
26
-	 */
27
-	public static function htmlPiece( Matcher $elementMatcher = null ) {
28
-		return new static( $elementMatcher );
29
-	}
30
-
31
-	private function __construct( Matcher $elementMatcher = null ) {
32
-		$this->elementMatcher = $elementMatcher;
33
-	}
34
-
35
-	public function describeTo( Description $description ) {
36
-		$description->appendText( 'valid html piece ' );
37
-		if ( $this->elementMatcher ) {
38
-			$description->appendDescriptionOf( $this->elementMatcher );
39
-		}
40
-	}
41
-
42
-	protected function matchesWithDiagnosticDescription( $html, Description $mismatchDescription ) {
43
-		$internalErrors = libxml_use_internal_errors( true );
44
-		$document = new \DOMDocument();
45
-
46
-		$html = $this->escapeScriptTagContents( $html );
47
-
48
-		if ( [email protected]$document->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ) ) ) {
49
-			$mismatchDescription->appendText( 'there was some parsing error' );
50
-			return false;
51
-		}
52
-
53
-		$errors = libxml_get_errors();
54
-		libxml_clear_errors();
55
-		libxml_use_internal_errors( $internalErrors );
56
-
57
-		$result = true;
58
-		/** @var \LibXMLError $error */
59
-		foreach ( $errors as $error ) {
60
-			if ( $this->isUnknownTagError( $error ) ) {
61
-				continue;
62
-			}
63
-
64
-			$mismatchDescription->appendText( 'there was parsing error: ' )
65
-				->appendText( trim( $error->message ) )
66
-				->appendText( ' on line ' )
67
-				->appendText( $error->line );
68
-			$result = false;
69
-		}
70
-
71
-		if ( $result === false ) {
72
-			return $result;
73
-		}
74
-		$mismatchDescription->appendText( 'valid html piece ' );
75
-
76
-		if ( $this->elementMatcher ) {
77
-			$result = $this->elementMatcher->matches( $document );
78
-			$this->elementMatcher->describeMismatch( $document, $mismatchDescription );
79
-		}
80
-
81
-		$mismatchDescription->appendText( "\nActual html:\n" )->appendText( $html );
82
-
83
-		return $result;
84
-	}
85
-
86
-	/**
87
-	 * @param \LibXMLError $error
88
-	 *
89
-	 * @return bool
90
-	 */
91
-	private function isUnknownTagError( \LibXMLError $error ) {
92
-		return $error->code === self::XML_UNKNOWN_TAG_ERROR_CODE;
93
-	}
94
-
95
-	/**
96
-	 * @param string $html
97
-	 *
98
-	 * @return string HTML
99
-	 */
100
-	private function escapeScriptTagContents( $html ) {
101
-		return preg_replace_callback( '#(<script.*>)(.*)(</script>)#isU', function ( $matches ) {
102
-			return $matches[1] . str_replace( '</', '<\/', $matches[2] ) . $matches[3];
103
-		}, $html );
104
-	}
11
+    /**
12
+     * @link http://www.xmlsoft.org/html/libxml-xmlerror.html#xmlParserErrors
13
+     * @link https://github.com/Chronic-Dev/libxml2/blob/683f296a905710ff285c28b8644ef3a3d8be9486/include/libxml/xmlerror.h#L257
14
+     */
15
+    const XML_UNKNOWN_TAG_ERROR_CODE = 801;
16
+
17
+    /**
18
+     * @var Matcher
19
+     */
20
+    private $elementMatcher;
21
+
22
+    /**
23
+     * @param Matcher $elementMatcher
24
+     *
25
+     * @return self
26
+     */
27
+    public static function htmlPiece( Matcher $elementMatcher = null ) {
28
+        return new static( $elementMatcher );
29
+    }
30
+
31
+    private function __construct( Matcher $elementMatcher = null ) {
32
+        $this->elementMatcher = $elementMatcher;
33
+    }
34
+
35
+    public function describeTo( Description $description ) {
36
+        $description->appendText( 'valid html piece ' );
37
+        if ( $this->elementMatcher ) {
38
+            $description->appendDescriptionOf( $this->elementMatcher );
39
+        }
40
+    }
41
+
42
+    protected function matchesWithDiagnosticDescription( $html, Description $mismatchDescription ) {
43
+        $internalErrors = libxml_use_internal_errors( true );
44
+        $document = new \DOMDocument();
45
+
46
+        $html = $this->escapeScriptTagContents( $html );
47
+
48
+        if ( [email protected]$document->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ) ) ) {
49
+            $mismatchDescription->appendText( 'there was some parsing error' );
50
+            return false;
51
+        }
52
+
53
+        $errors = libxml_get_errors();
54
+        libxml_clear_errors();
55
+        libxml_use_internal_errors( $internalErrors );
56
+
57
+        $result = true;
58
+        /** @var \LibXMLError $error */
59
+        foreach ( $errors as $error ) {
60
+            if ( $this->isUnknownTagError( $error ) ) {
61
+                continue;
62
+            }
63
+
64
+            $mismatchDescription->appendText( 'there was parsing error: ' )
65
+                ->appendText( trim( $error->message ) )
66
+                ->appendText( ' on line ' )
67
+                ->appendText( $error->line );
68
+            $result = false;
69
+        }
70
+
71
+        if ( $result === false ) {
72
+            return $result;
73
+        }
74
+        $mismatchDescription->appendText( 'valid html piece ' );
75
+
76
+        if ( $this->elementMatcher ) {
77
+            $result = $this->elementMatcher->matches( $document );
78
+            $this->elementMatcher->describeMismatch( $document, $mismatchDescription );
79
+        }
80
+
81
+        $mismatchDescription->appendText( "\nActual html:\n" )->appendText( $html );
82
+
83
+        return $result;
84
+    }
85
+
86
+    /**
87
+     * @param \LibXMLError $error
88
+     *
89
+     * @return bool
90
+     */
91
+    private function isUnknownTagError( \LibXMLError $error ) {
92
+        return $error->code === self::XML_UNKNOWN_TAG_ERROR_CODE;
93
+    }
94
+
95
+    /**
96
+     * @param string $html
97
+     *
98
+     * @return string HTML
99
+     */
100
+    private function escapeScriptTagContents( $html ) {
101
+        return preg_replace_callback( '#(<script.*>)(.*)(</script>)#isU', function ( $matches ) {
102
+            return $matches[1] . str_replace( '</', '<\/', $matches[2] ) . $matches[3];
103
+        }, $html );
104
+    }
105 105
 
106 106
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,61 +24,61 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return self
26 26
 	 */
27
-	public static function htmlPiece( Matcher $elementMatcher = null ) {
28
-		return new static( $elementMatcher );
27
+	public static function htmlPiece(Matcher $elementMatcher = null) {
28
+		return new static($elementMatcher);
29 29
 	}
30 30
 
31
-	private function __construct( Matcher $elementMatcher = null ) {
31
+	private function __construct(Matcher $elementMatcher = null) {
32 32
 		$this->elementMatcher = $elementMatcher;
33 33
 	}
34 34
 
35
-	public function describeTo( Description $description ) {
36
-		$description->appendText( 'valid html piece ' );
37
-		if ( $this->elementMatcher ) {
38
-			$description->appendDescriptionOf( $this->elementMatcher );
35
+	public function describeTo(Description $description) {
36
+		$description->appendText('valid html piece ');
37
+		if ($this->elementMatcher) {
38
+			$description->appendDescriptionOf($this->elementMatcher);
39 39
 		}
40 40
 	}
41 41
 
42
-	protected function matchesWithDiagnosticDescription( $html, Description $mismatchDescription ) {
43
-		$internalErrors = libxml_use_internal_errors( true );
42
+	protected function matchesWithDiagnosticDescription($html, Description $mismatchDescription) {
43
+		$internalErrors = libxml_use_internal_errors(true);
44 44
 		$document = new \DOMDocument();
45 45
 
46
-		$html = $this->escapeScriptTagContents( $html );
46
+		$html = $this->escapeScriptTagContents($html);
47 47
 
48
-		if ( [email protected]$document->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ) ) ) {
49
-			$mismatchDescription->appendText( 'there was some parsing error' );
48
+		if ([email protected]$document->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'))) {
49
+			$mismatchDescription->appendText('there was some parsing error');
50 50
 			return false;
51 51
 		}
52 52
 
53 53
 		$errors = libxml_get_errors();
54 54
 		libxml_clear_errors();
55
-		libxml_use_internal_errors( $internalErrors );
55
+		libxml_use_internal_errors($internalErrors);
56 56
 
57 57
 		$result = true;
58 58
 		/** @var \LibXMLError $error */
59
-		foreach ( $errors as $error ) {
60
-			if ( $this->isUnknownTagError( $error ) ) {
59
+		foreach ($errors as $error) {
60
+			if ($this->isUnknownTagError($error)) {
61 61
 				continue;
62 62
 			}
63 63
 
64
-			$mismatchDescription->appendText( 'there was parsing error: ' )
65
-				->appendText( trim( $error->message ) )
66
-				->appendText( ' on line ' )
67
-				->appendText( $error->line );
64
+			$mismatchDescription->appendText('there was parsing error: ')
65
+				->appendText(trim($error->message))
66
+				->appendText(' on line ')
67
+				->appendText($error->line);
68 68
 			$result = false;
69 69
 		}
70 70
 
71
-		if ( $result === false ) {
71
+		if ($result === false) {
72 72
 			return $result;
73 73
 		}
74
-		$mismatchDescription->appendText( 'valid html piece ' );
74
+		$mismatchDescription->appendText('valid html piece ');
75 75
 
76
-		if ( $this->elementMatcher ) {
77
-			$result = $this->elementMatcher->matches( $document );
78
-			$this->elementMatcher->describeMismatch( $document, $mismatchDescription );
76
+		if ($this->elementMatcher) {
77
+			$result = $this->elementMatcher->matches($document);
78
+			$this->elementMatcher->describeMismatch($document, $mismatchDescription);
79 79
 		}
80 80
 
81
-		$mismatchDescription->appendText( "\nActual html:\n" )->appendText( $html );
81
+		$mismatchDescription->appendText("\nActual html:\n")->appendText($html);
82 82
 
83 83
 		return $result;
84 84
 	}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return bool
90 90
 	 */
91
-	private function isUnknownTagError( \LibXMLError $error ) {
91
+	private function isUnknownTagError(\LibXMLError $error) {
92 92
 		return $error->code === self::XML_UNKNOWN_TAG_ERROR_CODE;
93 93
 	}
94 94
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return string HTML
99 99
 	 */
100
-	private function escapeScriptTagContents( $html ) {
101
-		return preg_replace_callback( '#(<script.*>)(.*)(</script>)#isU', function ( $matches ) {
102
-			return $matches[1] . str_replace( '</', '<\/', $matches[2] ) . $matches[3];
103
-		}, $html );
100
+	private function escapeScriptTagContents($html) {
101
+		return preg_replace_callback('#(<script.*>)(.*)(</script>)#isU', function($matches) {
102
+			return $matches[1] . str_replace('</', '<\/', $matches[2]) . $matches[3];
103
+		}, $html);
104 104
 	}
105 105
 
106 106
 }
Please login to merge, or discard this patch.
src/functions.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -3,87 +3,87 @@
 block discarded – undo
3 3
 use Hamcrest\Matcher;
4 4
 
5 5
 if ( !function_exists( 'htmlPiece' ) ) {
6
-	/**
7
-	 * @param Matcher|null $elementMatcher
8
-	 *
9
-	 * @return \WMDE\HamcrestHtml\HtmlMatcher
10
-	 */
11
-	function htmlPiece( Matcher $elementMatcher = null ) {
12
-		return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece( $elementMatcher );
13
-	}
6
+    /**
7
+     * @param Matcher|null $elementMatcher
8
+     *
9
+     * @return \WMDE\HamcrestHtml\HtmlMatcher
10
+     */
11
+    function htmlPiece( Matcher $elementMatcher = null ) {
12
+        return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece( $elementMatcher );
13
+    }
14 14
 }
15 15
 
16 16
 if ( !function_exists( 'havingRootElement' ) ) {
17
-	function havingRootElement( Matcher $matcher = null ) {
18
-		return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement( $matcher );
19
-	}
17
+    function havingRootElement( Matcher $matcher = null ) {
18
+        return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement( $matcher );
19
+    }
20 20
 }
21 21
 
22 22
 if ( !function_exists( 'havingDirectChild' ) ) {
23
-	function havingDirectChild( Matcher $elementMatcher = null ) {
24
-		return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild( $elementMatcher );
25
-	}
23
+    function havingDirectChild( Matcher $elementMatcher = null ) {
24
+        return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild( $elementMatcher );
25
+    }
26 26
 }
27 27
 
28 28
 if ( !function_exists( 'havingChild' ) ) {
29
-	function havingChild( Matcher $elementMatcher = null ) {
30
-		return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild( $elementMatcher );
31
-	}
29
+    function havingChild( Matcher $elementMatcher = null ) {
30
+        return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild( $elementMatcher );
31
+    }
32 32
 }
33 33
 
34 34
 if ( !function_exists( 'withTagName' ) ) {
35
-	/**
36
-	 * @param Matcher|string $tagName
37
-	 *
38
-	 * @return \WMDE\HamcrestHtml\TagNameMatcher
39
-	 */
40
-	function withTagName( $tagName ) {
41
-		return \WMDE\HamcrestHtml\TagNameMatcher::withTagName( $tagName );
42
-	}
35
+    /**
36
+     * @param Matcher|string $tagName
37
+     *
38
+     * @return \WMDE\HamcrestHtml\TagNameMatcher
39
+     */
40
+    function withTagName( $tagName ) {
41
+        return \WMDE\HamcrestHtml\TagNameMatcher::withTagName( $tagName );
42
+    }
43 43
 }
44 44
 
45 45
 if ( !function_exists( 'withAttribute' ) ) {
46
-	/**
47
-	 * @param Matcher|string $attributeName
48
-	 *
49
-	 * @return \WMDE\HamcrestHtml\AttributeMatcher
50
-	 */
51
-	function withAttribute( $attributeName ) {
52
-		return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute( $attributeName );
53
-	}
46
+    /**
47
+     * @param Matcher|string $attributeName
48
+     *
49
+     * @return \WMDE\HamcrestHtml\AttributeMatcher
50
+     */
51
+    function withAttribute( $attributeName ) {
52
+        return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute( $attributeName );
53
+    }
54 54
 }
55 55
 
56 56
 if ( !function_exists( 'withClass' ) ) {
57
-	/**
58
-	 * @param Matcher|string $class
59
-	 *
60
-	 * @return \WMDE\HamcrestHtml\ClassMatcher
61
-	 */
62
-	function withClass( $class ) {
63
-		// TODO don't allow to call with empty string
57
+    /**
58
+     * @param Matcher|string $class
59
+     *
60
+     * @return \WMDE\HamcrestHtml\ClassMatcher
61
+     */
62
+    function withClass( $class ) {
63
+        // TODO don't allow to call with empty string
64 64
 
65
-		return \WMDE\HamcrestHtml\ClassMatcher::withClass( $class );
66
-	}
65
+        return \WMDE\HamcrestHtml\ClassMatcher::withClass( $class );
66
+    }
67 67
 }
68 68
 
69 69
 if ( !function_exists( 'havingTextContents' ) ) {
70
-	/**
71
-	 * @param Matcher|string $text
72
-	 *
73
-	 * @return \WMDE\HamcrestHtml\TextContentsMatcher
74
-	 */
75
-	function havingTextContents( $text ) {
76
-		return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents( $text );
77
-	}
70
+    /**
71
+     * @param Matcher|string $text
72
+     *
73
+     * @return \WMDE\HamcrestHtml\TextContentsMatcher
74
+     */
75
+    function havingTextContents( $text ) {
76
+        return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents( $text );
77
+    }
78 78
 }
79 79
 
80 80
 if ( !function_exists( 'tagMatchingOutline' ) ) {
81
-	/**
82
-	 * @param string $htmlOutline
83
-	 *
84
-	 * @return \WMDE\HamcrestHtml\ComplexTagMatcher
85
-	 */
86
-	function tagMatchingOutline( $htmlOutline ) {
87
-		return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline( $htmlOutline );
88
-	}
81
+    /**
82
+     * @param string $htmlOutline
83
+     *
84
+     * @return \WMDE\HamcrestHtml\ComplexTagMatcher
85
+     */
86
+    function tagMatchingOutline( $htmlOutline ) {
87
+        return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline( $htmlOutline );
88
+    }
89 89
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -2,88 +2,88 @@
 block discarded – undo
2 2
 
3 3
 use Hamcrest\Matcher;
4 4
 
5
-if ( !function_exists( 'htmlPiece' ) ) {
5
+if (!function_exists('htmlPiece')) {
6 6
 	/**
7 7
 	 * @param Matcher|null $elementMatcher
8 8
 	 *
9 9
 	 * @return \WMDE\HamcrestHtml\HtmlMatcher
10 10
 	 */
11
-	function htmlPiece( Matcher $elementMatcher = null ) {
12
-		return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece( $elementMatcher );
11
+	function htmlPiece(Matcher $elementMatcher = null) {
12
+		return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece($elementMatcher);
13 13
 	}
14 14
 }
15 15
 
16
-if ( !function_exists( 'havingRootElement' ) ) {
17
-	function havingRootElement( Matcher $matcher = null ) {
18
-		return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement( $matcher );
16
+if (!function_exists('havingRootElement')) {
17
+	function havingRootElement(Matcher $matcher = null) {
18
+		return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement($matcher);
19 19
 	}
20 20
 }
21 21
 
22
-if ( !function_exists( 'havingDirectChild' ) ) {
23
-	function havingDirectChild( Matcher $elementMatcher = null ) {
24
-		return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild( $elementMatcher );
22
+if (!function_exists('havingDirectChild')) {
23
+	function havingDirectChild(Matcher $elementMatcher = null) {
24
+		return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild($elementMatcher);
25 25
 	}
26 26
 }
27 27
 
28
-if ( !function_exists( 'havingChild' ) ) {
29
-	function havingChild( Matcher $elementMatcher = null ) {
30
-		return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild( $elementMatcher );
28
+if (!function_exists('havingChild')) {
29
+	function havingChild(Matcher $elementMatcher = null) {
30
+		return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild($elementMatcher);
31 31
 	}
32 32
 }
33 33
 
34
-if ( !function_exists( 'withTagName' ) ) {
34
+if (!function_exists('withTagName')) {
35 35
 	/**
36 36
 	 * @param Matcher|string $tagName
37 37
 	 *
38 38
 	 * @return \WMDE\HamcrestHtml\TagNameMatcher
39 39
 	 */
40
-	function withTagName( $tagName ) {
41
-		return \WMDE\HamcrestHtml\TagNameMatcher::withTagName( $tagName );
40
+	function withTagName($tagName) {
41
+		return \WMDE\HamcrestHtml\TagNameMatcher::withTagName($tagName);
42 42
 	}
43 43
 }
44 44
 
45
-if ( !function_exists( 'withAttribute' ) ) {
45
+if (!function_exists('withAttribute')) {
46 46
 	/**
47 47
 	 * @param Matcher|string $attributeName
48 48
 	 *
49 49
 	 * @return \WMDE\HamcrestHtml\AttributeMatcher
50 50
 	 */
51
-	function withAttribute( $attributeName ) {
52
-		return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute( $attributeName );
51
+	function withAttribute($attributeName) {
52
+		return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute($attributeName);
53 53
 	}
54 54
 }
55 55
 
56
-if ( !function_exists( 'withClass' ) ) {
56
+if (!function_exists('withClass')) {
57 57
 	/**
58 58
 	 * @param Matcher|string $class
59 59
 	 *
60 60
 	 * @return \WMDE\HamcrestHtml\ClassMatcher
61 61
 	 */
62
-	function withClass( $class ) {
62
+	function withClass($class) {
63 63
 		// TODO don't allow to call with empty string
64 64
 
65
-		return \WMDE\HamcrestHtml\ClassMatcher::withClass( $class );
65
+		return \WMDE\HamcrestHtml\ClassMatcher::withClass($class);
66 66
 	}
67 67
 }
68 68
 
69
-if ( !function_exists( 'havingTextContents' ) ) {
69
+if (!function_exists('havingTextContents')) {
70 70
 	/**
71 71
 	 * @param Matcher|string $text
72 72
 	 *
73 73
 	 * @return \WMDE\HamcrestHtml\TextContentsMatcher
74 74
 	 */
75
-	function havingTextContents( $text ) {
76
-		return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents( $text );
75
+	function havingTextContents($text) {
76
+		return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents($text);
77 77
 	}
78 78
 }
79 79
 
80
-if ( !function_exists( 'tagMatchingOutline' ) ) {
80
+if (!function_exists('tagMatchingOutline')) {
81 81
 	/**
82 82
 	 * @param string $htmlOutline
83 83
 	 *
84 84
 	 * @return \WMDE\HamcrestHtml\ComplexTagMatcher
85 85
 	 */
86
-	function tagMatchingOutline( $htmlOutline ) {
87
-		return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline( $htmlOutline );
86
+	function tagMatchingOutline($htmlOutline) {
87
+		return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline($htmlOutline);
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
src/AttributeMatcher.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -8,80 +8,80 @@
 block discarded – undo
8 8
 
9 9
 class AttributeMatcher extends TagMatcher {
10 10
 
11
-	/**
12
-	 * @var Matcher
13
-	 */
14
-	private $attributeNameMatcher;
11
+    /**
12
+     * @var Matcher
13
+     */
14
+    private $attributeNameMatcher;
15 15
 
16
-	/**
17
-	 * @var Matcher|null
18
-	 */
19
-	private $valueMatcher;
16
+    /**
17
+     * @var Matcher|null
18
+     */
19
+    private $valueMatcher;
20 20
 
21
-	/**
22
-	 * @param Matcher|string $attributeName
23
-	 *
24
-	 * @return self
25
-	 */
26
-	public static function withAttribute( $attributeName ) {
27
-		return new static( Util::wrapValueWithIsEqual( $attributeName ) );
28
-	}
21
+    /**
22
+     * @param Matcher|string $attributeName
23
+     *
24
+     * @return self
25
+     */
26
+    public static function withAttribute( $attributeName ) {
27
+        return new static( Util::wrapValueWithIsEqual( $attributeName ) );
28
+    }
29 29
 
30
-	/**
31
-	 * @param Matcher $attributeNameMatcher
32
-	 */
33
-	public function __construct( Matcher $attributeNameMatcher ) {
34
-		parent::__construct();
30
+    /**
31
+     * @param Matcher $attributeNameMatcher
32
+     */
33
+    public function __construct( Matcher $attributeNameMatcher ) {
34
+        parent::__construct();
35 35
 
36
-		$this->attributeNameMatcher = $attributeNameMatcher;
37
-	}
36
+        $this->attributeNameMatcher = $attributeNameMatcher;
37
+    }
38 38
 
39
-	/**
40
-	 * @param Matcher|string $value
41
-	 *
42
-	 * @return AttributeMatcher
43
-	 */
44
-	public function havingValue( $value ) {
45
-		// TODO: Throw exception if value is set
46
-		$result = clone $this;
47
-		$result->valueMatcher = Util::wrapValueWithIsEqual( $value );
39
+    /**
40
+     * @param Matcher|string $value
41
+     *
42
+     * @return AttributeMatcher
43
+     */
44
+    public function havingValue( $value ) {
45
+        // TODO: Throw exception if value is set
46
+        $result = clone $this;
47
+        $result->valueMatcher = Util::wrapValueWithIsEqual( $value );
48 48
 
49
-		return $result;
50
-	}
49
+        return $result;
50
+    }
51 51
 
52
-	public function describeTo( Description $description ) {
53
-		$description->appendText( 'with attribute ' )
54
-			->appendDescriptionOf( $this->attributeNameMatcher );
55
-		if ( $this->valueMatcher ) {
56
-			$description->appendText( ' having value ' )
57
-				->appendDescriptionOf( $this->valueMatcher );
58
-		}
59
-	}
52
+    public function describeTo( Description $description ) {
53
+        $description->appendText( 'with attribute ' )
54
+            ->appendDescriptionOf( $this->attributeNameMatcher );
55
+        if ( $this->valueMatcher ) {
56
+            $description->appendText( ' having value ' )
57
+                ->appendDescriptionOf( $this->valueMatcher );
58
+        }
59
+    }
60 60
 
61
-	/**
62
-	 * @param \DOMElement $item
63
-	 * @param Description $mismatchDescription
64
-	 *
65
-	 * @return bool
66
-	 */
67
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
68
-		/** @var \DOMAttr $attribute */
69
-		foreach ( $item->attributes as $attribute ) {
70
-			if ( $this->valueMatcher ) {
71
-				if (
72
-					$this->attributeNameMatcher->matches( $attribute->name )
73
-					&& $this->valueMatcher->matches( $attribute->value )
74
-				) {
75
-					return true;
76
-				}
77
-			} else {
78
-				if ( $this->attributeNameMatcher->matches( $attribute->name ) ) {
79
-					return true;
80
-				}
81
-			}
82
-		}
61
+    /**
62
+     * @param \DOMElement $item
63
+     * @param Description $mismatchDescription
64
+     *
65
+     * @return bool
66
+     */
67
+    protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
68
+        /** @var \DOMAttr $attribute */
69
+        foreach ( $item->attributes as $attribute ) {
70
+            if ( $this->valueMatcher ) {
71
+                if (
72
+                    $this->attributeNameMatcher->matches( $attribute->name )
73
+                    && $this->valueMatcher->matches( $attribute->value )
74
+                ) {
75
+                    return true;
76
+                }
77
+            } else {
78
+                if ( $this->attributeNameMatcher->matches( $attribute->name ) ) {
79
+                    return true;
80
+                }
81
+            }
82
+        }
83 83
 
84
-		return false;
85
-	}
84
+        return false;
85
+    }
86 86
 
87 87
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @return self
25 25
 	 */
26
-	public static function withAttribute( $attributeName ) {
27
-		return new static( Util::wrapValueWithIsEqual( $attributeName ) );
26
+	public static function withAttribute($attributeName) {
27
+		return new static(Util::wrapValueWithIsEqual($attributeName));
28 28
 	}
29 29
 
30 30
 	/**
31 31
 	 * @param Matcher $attributeNameMatcher
32 32
 	 */
33
-	public function __construct( Matcher $attributeNameMatcher ) {
33
+	public function __construct(Matcher $attributeNameMatcher) {
34 34
 		parent::__construct();
35 35
 
36 36
 		$this->attributeNameMatcher = $attributeNameMatcher;
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return AttributeMatcher
43 43
 	 */
44
-	public function havingValue( $value ) {
44
+	public function havingValue($value) {
45 45
 		// TODO: Throw exception if value is set
46 46
 		$result = clone $this;
47
-		$result->valueMatcher = Util::wrapValueWithIsEqual( $value );
47
+		$result->valueMatcher = Util::wrapValueWithIsEqual($value);
48 48
 
49 49
 		return $result;
50 50
 	}
51 51
 
52
-	public function describeTo( Description $description ) {
53
-		$description->appendText( 'with attribute ' )
54
-			->appendDescriptionOf( $this->attributeNameMatcher );
55
-		if ( $this->valueMatcher ) {
56
-			$description->appendText( ' having value ' )
57
-				->appendDescriptionOf( $this->valueMatcher );
52
+	public function describeTo(Description $description) {
53
+		$description->appendText('with attribute ')
54
+			->appendDescriptionOf($this->attributeNameMatcher);
55
+		if ($this->valueMatcher) {
56
+			$description->appendText(' having value ')
57
+				->appendDescriptionOf($this->valueMatcher);
58 58
 		}
59 59
 	}
60 60
 
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool
66 66
 	 */
67
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
67
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
68 68
 		/** @var \DOMAttr $attribute */
69
-		foreach ( $item->attributes as $attribute ) {
70
-			if ( $this->valueMatcher ) {
69
+		foreach ($item->attributes as $attribute) {
70
+			if ($this->valueMatcher) {
71 71
 				if (
72
-					$this->attributeNameMatcher->matches( $attribute->name )
73
-					&& $this->valueMatcher->matches( $attribute->value )
72
+					$this->attributeNameMatcher->matches($attribute->name)
73
+					&& $this->valueMatcher->matches($attribute->value)
74 74
 				) {
75 75
 					return true;
76 76
 				}
77 77
 			} else {
78
-				if ( $this->attributeNameMatcher->matches( $attribute->name ) ) {
78
+				if ($this->attributeNameMatcher->matches($attribute->name)) {
79 79
 					return true;
80 80
 				}
81 81
 			}
Please login to merge, or discard this patch.
src/ClassMatcher.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@
 block discarded – undo
8 8
 
9 9
 class ClassMatcher extends TagMatcher {
10 10
 
11
-	/**
12
-	 * @var Matcher
13
-	 */
14
-	private $classMatcher;
15
-
16
-	/**
17
-	 * @param Matcher|string $class
18
-	 *
19
-	 * @return self
20
-	 */
21
-	public static function withClass( $class ) {
22
-		return new static( Util::wrapValueWithIsEqual( $class ) );
23
-	}
24
-