File tree Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -219,15 +219,15 @@ public function equals(Definition $definition)
219
219
return false ;
220
220
}
221
221
222
- if (! is_array ( $ this ->name ) xor ! is_array ( $ definition ->name ) ) {
222
+ if (null !== $ this ->name xor null !== $ definition ->name ) {
223
223
return false ;
224
224
}
225
225
226
- if (! is_array ( $ this ->description ) xor ! is_array ( $ definition ->description ) ) {
226
+ if (null !== $ this ->description xor null !== $ definition ->description ) {
227
227
return false ;
228
228
}
229
229
230
- if (is_array ( $ this ->name ) ) {
230
+ if (null !== $ this ->name ) {
231
231
foreach ($ this ->name as $ language => $ value ) {
232
232
if (!isset ($ definition ->name [$ language ])) {
233
233
return false ;
@@ -239,7 +239,7 @@ public function equals(Definition $definition)
239
239
}
240
240
}
241
241
242
- if (is_array ( $ this ->description ) ) {
242
+ if (null !== $ this ->description ) {
243
243
foreach ($ this ->description as $ language => $ value ) {
244
244
if (!isset ($ definition ->description [$ language ])) {
245
245
return false ;
Original file line number Diff line number Diff line change 16
16
*
17
17
* @author Christian Flothmann <[email protected] >
18
18
*/
19
- final class LanguageMap implements \ArrayAccess
19
+ final class LanguageMap implements \ArrayAccess, \Countable
20
20
{
21
21
private $ map ;
22
22
@@ -104,6 +104,11 @@ public function offsetUnset($languageTag)
104
104
throw new \LogicException ('Entries of a language map cannot be removed. ' );
105
105
}
106
106
107
+ public function count ()
108
+ {
109
+ return count ($ this ->map );
110
+ }
111
+
107
112
public function equals (LanguageMap $ languageMap )
108
113
{
109
114
if (count ($ this ->map ) !== count ($ languageMap ->map )) {
Original file line number Diff line number Diff line change @@ -75,23 +75,25 @@ public function equals(Verb $verb)
75
75
return false ;
76
76
}
77
77
78
- if (!is_array ($ this ->display ) xor !is_array ($ verb ->display )) {
78
+ if (null === $ this ->display && null === $ verb ->display ) {
79
+ return true ;
80
+ }
81
+
82
+ if (null !== $ this ->display xor null !== $ verb ->display ) {
79
83
return false ;
80
84
}
81
85
82
86
if (count ($ this ->display ) !== count ($ verb ->getDisplay ())) {
83
87
return false ;
84
88
}
85
89
86
- if (is_array ($ this ->display )) {
87
- foreach ($ this ->display as $ language => $ value ) {
88
- if (!isset ($ verb ->display [$ language ])) {
89
- return false ;
90
- }
90
+ foreach ($ this ->display as $ language => $ value ) {
91
+ if (!isset ($ verb ->display [$ language ])) {
92
+ return false ;
93
+ }
91
94
92
- if ($ value !== $ verb ->display [$ language ]) {
93
- return false ;
94
- }
95
+ if ($ value !== $ verb ->display [$ language ]) {
96
+ return false ;
95
97
}
96
98
}
97
99
You can’t perform that action at this time.
0 commit comments