@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | */ |
19 | 19 | private $valueMatcher; |
20 | 20 | |
21 | - public static function withAttribute( $attributeName ) { |
|
22 | - return new static( Util::wrapValueWithIsEqual( $attributeName ) ); |
|
21 | + public static function withAttribute($attributeName) { |
|
22 | + return new static(Util::wrapValueWithIsEqual($attributeName)); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * AttributeMatcher constructor. |
27 | 27 | * @param \Hamcrest\Matcher $attributeNameMatcher |
28 | 28 | */ |
29 | - public function __construct( Matcher $attributeNameMatcher ) { |
|
29 | + public function __construct(Matcher $attributeNameMatcher) { |
|
30 | 30 | parent::__construct(); |
31 | 31 | |
32 | 32 | $this->attributeNameMatcher = $attributeNameMatcher; |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | * @param Matcher|mixed $value |
37 | 37 | * @return AttributeMatcher |
38 | 38 | */ |
39 | - public function havingValue( $value ) { |
|
39 | + public function havingValue($value) { |
|
40 | 40 | //TODO: Throw exception if value is set |
41 | 41 | $result = clone $this; |
42 | - $result->valueMatcher = Util::wrapValueWithIsEqual( $value ); |
|
42 | + $result->valueMatcher = Util::wrapValueWithIsEqual($value); |
|
43 | 43 | |
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public function describeTo( Description $description ) { |
|
48 | - $description->appendText( 'with attribute ' ) |
|
49 | - ->appendDescriptionOf( $this->attributeNameMatcher ); |
|
50 | - if ( $this->valueMatcher ) { |
|
51 | - $description->appendText( ' having value ' ) |
|
52 | - ->appendDescriptionOf( $this->valueMatcher ); |
|
47 | + public function describeTo(Description $description) { |
|
48 | + $description->appendText('with attribute ') |
|
49 | + ->appendDescriptionOf($this->attributeNameMatcher); |
|
50 | + if ($this->valueMatcher) { |
|
51 | + $description->appendText(' having value ') |
|
52 | + ->appendDescriptionOf($this->valueMatcher); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | - protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) { |
|
62 | + protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) { |
|
63 | 63 | /** @var \DOMAttr $attribute */ |
64 | - foreach ( $item->attributes as $attribute ) { |
|
65 | - if ( $this->valueMatcher ) { |
|
64 | + foreach ($item->attributes as $attribute) { |
|
65 | + if ($this->valueMatcher) { |
|
66 | 66 | if ( |
67 | - $this->attributeNameMatcher->matches( $attribute->name ) |
|
68 | - && $this->valueMatcher->matches( $attribute->value ) |
|
67 | + $this->attributeNameMatcher->matches($attribute->name) |
|
68 | + && $this->valueMatcher->matches($attribute->value) |
|
69 | 69 | ) { |
70 | 70 | return true; |
71 | 71 | } |
72 | 72 | } else { |
73 | - if ( $this->attributeNameMatcher->matches( $attribute->name ) ) { |
|
73 | + if ($this->attributeNameMatcher->matches($attribute->name)) { |
|
74 | 74 | return true; |
75 | 75 | } |
76 | 76 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | abstract class TagMatcher extends TypeSafeDiagnosingMatcher { |
8 | 8 | |
9 | 9 | public function __construct() { |
10 | - parent::__construct( self::TYPE_OBJECT, \DOMElement::class ); |
|
10 | + parent::__construct(self::TYPE_OBJECT, \DOMElement::class); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | } |