@@ -58,7 +58,7 @@ public static function isProperSubsetOf(
5858 $ allowExtra ,
5959 $ isOrdered
6060 ) {
61-
61+
6262 if ($ leftTree == null ) {
6363 return true ;
6464 }
@@ -123,7 +123,7 @@ public static function isProperSubsetOf(
123123 }
124124 return true ;
125125 }
126-
126+
127127 /**
128128 * Recursively check whether the left JSON object is a proper subset of the right JSON object
129129 * @param array $leftObject Left JSON object as string
@@ -140,7 +140,7 @@ public static function isJsonObjectProperSubsetOf(
140140 $ allowExtra ,
141141 $ isOrdered
142142 ) {
143-
143+
144144 return static ::isProperSubsetOf (
145145 APIHelper::deserialize ($ leftObject ),
146146 APIHelper::deserialize ($ rightObject ),
@@ -149,7 +149,7 @@ public static function isJsonObjectProperSubsetOf(
149149 $ isOrdered
150150 );
151151 }
152-
152+
153153 /**
154154 * Check if left array of objects is a subset of right array
155155 * @param array $leftObject Left array as a JSON string
@@ -166,11 +166,11 @@ public static function isArrayOfStringifiedJsonObjectsProperSubsetOf(
166166 $ allowExtra ,
167167 $ isOrdered
168168 ) {
169-
169+
170170 // Deserialize left and right objects from their respective strings
171171 $ left = APIHelper::deserialize ($ leftObject );
172172 $ right = APIHelper::deserialize ($ rightObject );
173-
173+
174174 return static ::isArrayOfJsonObjectsProperSubsetOf (
175175 $ left ,
176176 $ right ,
@@ -196,27 +196,27 @@ public static function isArrayOfJsonObjectsProperSubsetOf(
196196 $ allowExtra ,
197197 $ isOrdered
198198 ) {
199-
199+
200200 // Return false if size different and checking was strict
201201 if (!$ allowExtra && count ($ left ) != count ($ right )) {
202202 return false ;
203203 }
204-
204+
205205 // Create list iterators
206206 $ leftIter = (new \ArrayObject ($ left ))->getIterator ();
207207 $ rightIter = (new \ArrayObject ($ right ))->getIterator ();
208-
208+
209209 // Iterate left list and check if each value is present in the right list
210210 while ($ leftIter ->valid ()) {
211211 $ leftIter ->next ();
212212 $ leftTree = $ leftIter ->current ();
213213 $ found = false ;
214-
214+
215215 // If order is not required, then search right array from beginning
216216 if (!$ isOrdered ) {
217217 $ rightIter ->rewind ();
218218 }
219-
219+
220220 // Check each right element to see if left is a subset
221221 while ($ rightIter ->valid ()) {
222222 $ rightIter ->next ();
@@ -231,15 +231,15 @@ public static function isArrayOfJsonObjectsProperSubsetOf(
231231 break ;
232232 }
233233 }
234-
234+
235235 if (!$ found ) {
236236 return false ;
237237 }
238238 }
239-
239+
240240 return true ;
241241 }
242-
242+
243243 /**
244244 * Check whether the a list is a subset of another list
245245 * @param array $leftList Expected List
@@ -254,7 +254,7 @@ public static function isListProperSubsetOf(
254254 $ allowExtra ,
255255 $ isOrdered
256256 ) {
257-
257+
258258 if ($ isOrdered && !$ allowExtra ) {
259259 return $ leftList === $ rightList ;
260260 } elseif ($ isOrdered && $ allowExtra ) {
@@ -267,7 +267,7 @@ public static function isListProperSubsetOf(
267267 }
268268 return true ;
269269 }
270-
270+
271271 /**
272272 * Recursively check whether the left headers map is a proper subset of
273273 * the right headers map. Header keys & values are compared case-insensitive.
@@ -282,7 +282,7 @@ public static function areHeadersProperSubsetOf(
282282 array $ rightTree ,
283283 $ checkValues
284284 ) {
285-
285+
286286 // Http headers are case-insensitive
287287 $ l = array_change_key_case ($ leftTree );
288288 $ r = array_change_key_case ($ rightTree );
@@ -345,4 +345,10 @@ public static function getJsonMapper()
345345 return $ mapper ;
346346 }
347347
348+ public static function getAuthorizationFromEnvironment ()
349+ {
350+ Configuration::$ basicAuthUserName = getenv ('MessageMediaApiTestsKey ' );
351+ Configuration::$ basicAuthPassword = getenv ('MessageMediaApiTestsSecret ' );
352+ }
353+
348354}
0 commit comments