mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-29 00:25:17 +03:00
Use key-value foreach
This commit is contained in:
parent
2295b96a49
commit
00490d289c
@ -34,11 +34,8 @@ use GraphQL\Utils\Utils;
|
|||||||
use SplQueue;
|
use SplQueue;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use function array_keys;
|
|
||||||
use function count;
|
|
||||||
use function is_array;
|
use function is_array;
|
||||||
use function is_string;
|
use function is_string;
|
||||||
use function range;
|
|
||||||
use function sprintf;
|
use function sprintf;
|
||||||
|
|
||||||
class CoroutineExecutor implements Runtime, ExecutorImplementation
|
class CoroutineExecutor implements Runtime, ExecutorImplementation
|
||||||
@ -155,13 +152,8 @@ class CoroutineExecutor implements Runtime, ExecutorImplementation
|
|||||||
|
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$array = [];
|
$array = [];
|
||||||
$isAssoc = array_keys($value) !== range(0, count($value) - 1);
|
|
||||||
foreach ($value as $key => $item) {
|
foreach ($value as $key => $item) {
|
||||||
if ($isAssoc) {
|
|
||||||
$array[$key] = self::resultToArray($item);
|
$array[$key] = self::resultToArray($item);
|
||||||
} else {
|
|
||||||
$array[] = self::resultToArray($item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user