mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-24 13:29:23 +00:00
Consider CaseInsensitiveArray an associative array.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Curl;
|
||||
|
||||
use Curl\CaseInsensitiveArray;
|
||||
|
||||
class ArrayUtil
|
||||
{
|
||||
/**
|
||||
@@ -14,7 +16,10 @@ class ArrayUtil
|
||||
*/
|
||||
public static function isArrayAssoc($array)
|
||||
{
|
||||
return is_array($array) && (bool)count(array_filter(array_keys($array), 'is_string'));
|
||||
return (
|
||||
$array instanceof CaseInsensitiveArray ||
|
||||
(bool)count(array_filter(array_keys($array), 'is_string'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace CurlTest;
|
||||
|
||||
use Curl\ArrayUtil;
|
||||
use Curl\CaseInsensitiveArray;
|
||||
|
||||
class ArrayUtilTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testCaseInsensitiveArrayIsArrayAssoc()
|
||||
{
|
||||
$array = new CaseInsensitiveArray();
|
||||
$this->assertTrue(ArrayUtil::isArrayAssoc($array));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user