@@ -8,40 +8,40 @@ |
||
| 8 | 8 | |
| 9 | 9 | class TagNameMatcher extends TagMatcher { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @var Matcher |
|
| 13 | - */ |
|
| 14 | - private $tagNameMatcher; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * @param Matcher|string $tagName |
|
| 18 | - * |
|
| 19 | - * @return self |
|
| 20 | - */ |
|
| 21 | - public static function withTagName( $tagName ) { |
|
| 22 | - return new static( Util::wrapValueWithIsEqual( $tagName ) ); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public function __construct( Matcher $tagNameMatcher ) { |
|
| 26 | - parent::__construct(); |
|
| 27 | - $this->tagNameMatcher = $tagNameMatcher; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function describeTo( Description $description ) { |
|
| 31 | - $description->appendText( 'with tag name ' ) |
|
| 32 | - ->appendDescriptionOf( $this->tagNameMatcher ); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @param \DOMElement $item |
|
| 37 | - * @param Description $mismatchDescription |
|
| 38 | - * |
|
| 39 | - * @return bool |
|
| 40 | - */ |
|
| 41 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 42 | - $mismatchDescription->appendText( 'tag name ' ); |
|
| 43 | - $this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription ); |
|
| 44 | - return $this->tagNameMatcher->matches( $item->tagName ); |
|
| 45 | - } |
|
| 11 | + /** |
|
| 12 | + * @var Matcher |
|
| 13 | + */ |
|
| 14 | + private $tagNameMatcher; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @param Matcher|string $tagName |
|
| 18 | + * |
|
| 19 | + * @return self |
|
| 20 | + */ |
|
| 21 | + public static function withTagName( $tagName ) { |
|
| 22 | + return new static( Util::wrapValueWithIsEqual( $tagName ) ); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public function __construct( Matcher $tagNameMatcher ) { |
|
| 26 | + parent::__construct(); |
|
| 27 | + $this->tagNameMatcher = $tagNameMatcher; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function describeTo( Description $description ) { |
|
| 31 | + $description->appendText( 'with tag name ' ) |
|
| 32 | + ->appendDescriptionOf( $this->tagNameMatcher ); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @param \DOMElement $item |
|
| 37 | + * @param Description $mismatchDescription |
|
| 38 | + * |
|
| 39 | + * @return bool |
|
| 40 | + */ |
|
| 41 | + protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 42 | + $mismatchDescription->appendText( 'tag name ' ); |
|
| 43 | + $this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription ); |
|
| 44 | + return $this->tagNameMatcher->matches( $item->tagName ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | } |
@@ -18,18 +18,18 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return self |
| 20 | 20 | */ |
| 21 | - public static function withTagName( $tagName ) { |
|
| 22 | - return new static( Util::wrapValueWithIsEqual( $tagName ) ); |
|
| 21 | + public static function withTagName($tagName) { |
|
| 22 | + return new static(Util::wrapValueWithIsEqual($tagName)); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function __construct( Matcher $tagNameMatcher ) { |
|
| 25 | + public function __construct(Matcher $tagNameMatcher) { |
|
| 26 | 26 | parent::__construct(); |
| 27 | 27 | $this->tagNameMatcher = $tagNameMatcher; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function describeTo( Description $description ) { |
|
| 31 | - $description->appendText( 'with tag name ' ) |
|
| 32 | - ->appendDescriptionOf( $this->tagNameMatcher ); |
|
| 30 | + public function describeTo(Description $description) { |
|
| 31 | + $description->appendText('with tag name ') |
|
| 32 | + ->appendDescriptionOf($this->tagNameMatcher); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 42 | - $mismatchDescription->appendText( 'tag name ' ); |
|
| 43 | - $this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription ); |
|
| 44 | - return $this->tagNameMatcher->matches( $item->tagName ); |
|
| 41 | + protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) { |
|
| 42 | + $mismatchDescription->appendText('tag name '); |
|
| 43 | + $this->tagNameMatcher->describeMismatch($item->tagName, $mismatchDescription); |
|
| 44 | + return $this->tagNameMatcher->matches($item->tagName); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | } |
@@ -8,37 +8,37 @@ |
||
| 8 | 8 | |
| 9 | 9 | class TextContentsMatcher extends TagMatcher { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @var Matcher |
|
| 13 | - */ |
|
| 14 | - private $matcher; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * @param Matcher|string $text |
|
| 18 | - * |
|
| 19 | - * @return self |
|
| 20 | - */ |
|
| 21 | - public static function havingTextContents( $text ) { |
|
| 22 | - return new static( Util::wrapValueWithIsEqual( $text ) ); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - public function __construct( Matcher $matcher ) { |
|
| 26 | - parent::__construct(); |
|
| 27 | - $this->matcher = $matcher; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - public function describeTo( Description $description ) { |
|
| 31 | - $description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher ); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @param \DOMElement $item |
|
| 36 | - * @param Description $mismatchDescription |
|
| 37 | - * |
|
| 38 | - * @return bool |
|
| 39 | - */ |
|
| 40 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 41 | - return $this->matcher->matches( $item->textContent ); |
|
| 42 | - } |
|
| 11 | + /** |
|
| 12 | + * @var Matcher |
|
| 13 | + */ |
|
| 14 | + private $matcher; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @param Matcher|string $text |
|
| 18 | + * |
|
| 19 | + * @return self |
|
| 20 | + */ |
|
| 21 | + public static function havingTextContents( $text ) { |
|
| 22 | + return new static( Util::wrapValueWithIsEqual( $text ) ); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + public function __construct( Matcher $matcher ) { |
|
| 26 | + parent::__construct(); |
|
| 27 | + $this->matcher = $matcher; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + public function describeTo( Description $description ) { |
|
| 31 | + $description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher ); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @param \DOMElement $item |
|
| 36 | + * @param Description $mismatchDescription |
|
| 37 | + * |
|
| 38 | + * @return bool |
|
| 39 | + */ |
|
| 40 | + protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 41 | + return $this->matcher->matches( $item->textContent ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | } |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return self |
| 20 | 20 | */ |
| 21 | - public static function havingTextContents( $text ) { |
|
| 22 | - return new static( Util::wrapValueWithIsEqual( $text ) ); |
|
| 21 | + public static function havingTextContents($text) { |
|
| 22 | + return new static(Util::wrapValueWithIsEqual($text)); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function __construct( Matcher $matcher ) { |
|
| 25 | + public function __construct(Matcher $matcher) { |
|
| 26 | 26 | parent::__construct(); |
| 27 | 27 | $this->matcher = $matcher; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function describeTo( Description $description ) { |
|
| 31 | - $description->appendText( 'having text contents ' )->appendDescriptionOf( $this->matcher ); |
|
| 30 | + public function describeTo(Description $description) { |
|
| 31 | + $description->appendText('having text contents ')->appendDescriptionOf($this->matcher); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return bool |
| 39 | 39 | */ |
| 40 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
| 41 | - return $this->matcher->matches( $item->textContent ); |
|
| 40 | + protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) { |
|
| 41 | + return $this->matcher->matches($item->textContent); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | } |