@@ -219,7 +219,7 @@ public function setCookieJar($cookie_jar)
219
219
220
220
public function setOpt ($ option , $ value , $ _ch = null )
221
221
{
222
- $ ch = is_null ( $ _ch) ? $ this ->curl : $ _ch ;
222
+ $ ch = $ _ch === null ? $ this ->curl : $ _ch ;
223
223
224
224
$ required_options = array (
225
225
CURLINFO_HEADER_OUT => 'CURLINFO_HEADER_OUT ' ,
@@ -330,15 +330,12 @@ private function parseResponse($response)
330
330
$ raw_response = $ response ;
331
331
332
332
if (isset ($ response_headers ['Content-Type ' ])) {
333
- if (preg_match ( ' /^application\/json/i ' , $ response_headers ['Content-Type ' ]) ) {
333
+ if (stripos ( $ response_headers ['Content-Type ' ], ' application/json ' ) === 0 ) {
334
334
$ json_obj = json_decode ($ response , false );
335
- if (! is_null ( $ json_obj) ) {
335
+ if ($ json_obj !== null ) {
336
336
$ response = $ json_obj ;
337
337
}
338
- } elseif (preg_match ('/^application\/atom\+xml/i ' , $ response_headers ['Content-Type ' ]) ||
339
- preg_match ('/^application\/rss\+xml/i ' , $ response_headers ['Content-Type ' ]) ||
340
- preg_match ('/^application\/xml/i ' , $ response_headers ['Content-Type ' ]) ||
341
- preg_match ('/^text\/xml/i ' , $ response_headers ['Content-Type ' ])) {
338
+ } elseif (preg_match ('~^(?:text/|application/(?:atom\+|rss\+)?)xml~i ' , $ response_headers ['Content-Type ' ])) {
342
339
$ xml_obj = @simplexml_load_string ($ response );
343
340
if (!($ xml_obj === false )) {
344
341
$ response = $ xml_obj ;
@@ -398,7 +395,7 @@ private function postfields($data)
398
395
399
396
protected function exec ($ _ch = null )
400
397
{
401
- $ ch = is_null ( $ _ch) ? $ this : $ _ch ;
398
+ $ ch = $ _ch === null ? $ this : $ _ch ;
402
399
403
400
if ($ ch ->multi_child ) {
404
401
$ ch ->raw_response = curl_multi_getcontent ($ ch ->curl );
@@ -461,7 +458,7 @@ public static function is_array_multidim($array)
461
458
return false ;
462
459
}
463
460
464
- return !( count ( $ array ) === count ($ array , COUNT_RECURSIVE ));
461
+ return ( bool ) count (array_filter ( $ array , ' is_array ' ));
465
462
}
466
463
467
464
public static function http_build_multi_query ($ data , $ key = null )
@@ -477,9 +474,9 @@ public static function http_build_multi_query($data, $key = null)
477
474
foreach ($ data as $ k => $ value ) {
478
475
if (is_string ($ value ) || is_numeric ($ value )) {
479
476
$ brackets = $ is_array_assoc ? '[ ' . $ k . '] ' : '[] ' ;
480
- $ query [] = urlencode (is_null ( $ key) ? $ k : $ key . $ brackets ) . '= ' . rawurlencode ($ value );
477
+ $ query [] = urlencode ($ key === null ? $ k : $ key . $ brackets ) . '= ' . rawurlencode ($ value );
481
478
} elseif (is_array ($ value )) {
482
- $ nested = is_null ( $ key) ? $ k : $ key . '[ ' . $ k . '] ' ;
479
+ $ nested = $ key === null ? $ k : $ key . '[ ' . $ k . '] ' ;
483
480
$ query [] = self ::http_build_multi_query ($ value , $ nested );
484
481
}
485
482
}
@@ -494,7 +491,7 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator
494
491
495
492
public function offsetSet ($ offset , $ value )
496
493
{
497
- if (is_null ( $ offset) ) {
494
+ if ($ offset === null ) {
498
495
$ this ->container [] = $ value ;
499
496
} else {
500
497
$ index = array_search (strtolower ($ offset ), array_keys (array_change_key_case ($ this ->container , CASE_LOWER )));
0 commit comments