@@ -17,24 +17,24 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return self |
19 | 19 | */ |
20 | - public static function havingTextContents( $text ) { |
|
21 | - return new static( $text ); |
|
20 | + public static function havingTextContents($text) { |
|
21 | + return new static($text); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @param Matcher|string $matcher |
26 | 26 | */ |
27 | - public function __construct( $matcher ) { |
|
27 | + public function __construct($matcher) { |
|
28 | 28 | parent::__construct(); |
29 | 29 | $this->matcher = $matcher; |
30 | 30 | } |
31 | 31 | |
32 | - public function describeTo( Description $description ) { |
|
33 | - $description->appendText( 'having text contents ' ); |
|
34 | - if ( $this->matcher instanceof Matcher ) { |
|
35 | - $description->appendDescriptionOf( $this->matcher ); |
|
32 | + public function describeTo(Description $description) { |
|
33 | + $description->appendText('having text contents '); |
|
34 | + if ($this->matcher instanceof Matcher) { |
|
35 | + $description->appendDescriptionOf($this->matcher); |
|
36 | 36 | } else { |
37 | - $description->appendValue( $this->matcher ); |
|
37 | + $description->appendValue($this->matcher); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return bool |
46 | 46 | */ |
47 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
48 | - if ( $this->matcher instanceof Matcher ) { |
|
49 | - return $this->matcher->matches( $item->textContent ); |
|
47 | + protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) { |
|
48 | + if ($this->matcher instanceof Matcher) { |
|
49 | + return $this->matcher->matches($item->textContent); |
|
50 | 50 | } else { |
51 | 51 | return $item->textContent === (string)$this->matcher; |
52 | 52 | } |
@@ -18,25 +18,25 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return self |
20 | 20 | */ |
21 | - public static function havingChild( $elementMatcher = null ) { |
|
22 | - return new static( $elementMatcher ); |
|
21 | + public static function havingChild($elementMatcher = null) { |
|
22 | + return new static($elementMatcher); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param Matcher|string|null $matcher |
27 | 27 | */ |
28 | - public function __construct( $matcher = null ) { |
|
29 | - parent::__construct( \DOMNode::class ); |
|
28 | + public function __construct($matcher = null) { |
|
29 | + parent::__construct(\DOMNode::class); |
|
30 | 30 | $this->matcher = $matcher; |
31 | 31 | } |
32 | 32 | |
33 | - public function describeTo( Description $description ) { |
|
34 | - $description->appendText( 'having child ' ); |
|
35 | - if ( $this->matcher ) { |
|
36 | - if ( $this->matcher instanceof Matcher ) { |
|
37 | - $description->appendDescriptionOf( $this->matcher ); |
|
33 | + public function describeTo(Description $description) { |
|
34 | + $description->appendText('having child '); |
|
35 | + if ($this->matcher) { |
|
36 | + if ($this->matcher instanceof Matcher) { |
|
37 | + $description->appendDescriptionOf($this->matcher); |
|
38 | 38 | } else { |
39 | - $description->appendValue( $this->matcher ); |
|
39 | + $description->appendValue($this->matcher); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -47,35 +47,35 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @return bool |
49 | 49 | */ |
50 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
51 | - if ( $item instanceof \DOMDocument ) { |
|
52 | - $item = $item->documentElement->childNodes->item( 0 ); |
|
50 | + protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) { |
|
51 | + if ($item instanceof \DOMDocument) { |
|
52 | + $item = $item->documentElement->childNodes->item(0); |
|
53 | 53 | /** @var \DOMElement $item */ |
54 | 54 | } |
55 | 55 | $directChildren = $item->childNodes; |
56 | 56 | |
57 | - if ( $directChildren->length === 0 ) { |
|
58 | - $mismatchDescription->appendText( 'having no children' ); |
|
57 | + if ($directChildren->length === 0) { |
|
58 | + $mismatchDescription->appendText('having no children'); |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - if ( !$this->matcher ) { |
|
62 | + if (!$this->matcher) { |
|
63 | 63 | return true; |
64 | 64 | } |
65 | 65 | |
66 | - if ( $this->matcher instanceof Matcher ) { |
|
67 | - foreach ( new XmlNodeRecursiveIterator( $directChildren ) as $child ) { |
|
68 | - if ( $this->matcher->matches( $child ) ) { |
|
66 | + if ($this->matcher instanceof Matcher) { |
|
67 | + foreach (new XmlNodeRecursiveIterator($directChildren) as $child) { |
|
68 | + if ($this->matcher->matches($child)) { |
|
69 | 69 | return true; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | } else { |
73 | - if ( $item->getElementsByTagName( $this->matcher )->length !== 0 ) { |
|
73 | + if ($item->getElementsByTagName($this->matcher)->length !== 0) { |
|
74 | 74 | return true; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - $mismatchDescription->appendText( 'having no children ' )->appendDescriptionOf( $this->matcher ); |
|
78 | + $mismatchDescription->appendText('having no children ')->appendDescriptionOf($this->matcher); |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 |