@@ -76,7 +76,7 @@ function (callable $resolve, callable $reject) use ($key) {
76
76
'reject ' => $ reject ,
77
77
];
78
78
79
- if (count ($ this ->promiseQueue ) === 1 ) {
79
+ if (\ count ($ this ->promiseQueue ) === 1 ) {
80
80
$ this ->scheduleDispatch ();
81
81
}
82
82
}
@@ -95,7 +95,7 @@ function (callable $resolve, callable $reject) use ($key) {
95
95
public function loadMany (array $ keys )
96
96
{
97
97
return \React \Promise \all (
98
- array_map (
98
+ \ array_map (
99
99
function ($ key ) {
100
100
return $ this ->load ($ key );
101
101
},
@@ -187,17 +187,17 @@ private function dispatchQueue()
187
187
*/
188
188
private function dispatchQueueBatch ($ batch )
189
189
{
190
- $ keys = array_column ($ batch , 'key ' );
190
+ $ keys = \ array_column ($ batch , 'key ' );
191
191
$ batchLoadFunction = $ this ->batchLoadFunction ;
192
192
193
193
/** @var Promise $batchPromise */
194
194
$ batchPromise = $ batchLoadFunction ($ keys );
195
195
196
- if (! $ batchPromise || ! is_callable ([$ batchPromise , 'then ' ])) {
196
+ if (! $ batchPromise || ! \ is_callable ([$ batchPromise , 'then ' ])) {
197
197
return $ this ->handleFailedDispatch ($ batch , new DataLoaderException (
198
198
self ::class . ' must be constructed with a function which accepts ' .
199
199
'an array of keys and returns a Promise which resolves to an array of values ' .
200
- sprintf ('not return a Promise: %s. ' , gettype ($ batchPromise ))
200
+ \ sprintf ('not return a Promise: %s. ' , \ gettype ($ batchPromise ))
201
201
));
202
202
}
203
203
@@ -221,11 +221,11 @@ function ($values) use ($batch, $keys) {
221
221
*/
222
222
private function dispatchQueueInMultipleBatches (array $ queue , $ maxBatchSize )
223
223
{
224
- $ numberOfBatchesToDispatch = count ($ queue ) / $ maxBatchSize ;
224
+ $ numberOfBatchesToDispatch = \ count ($ queue ) / $ maxBatchSize ;
225
225
226
226
for ($ i = 0 ; $ i < $ numberOfBatchesToDispatch ; $ i ++) {
227
227
$ this ->dispatchQueueBatch (
228
- array_slice ($ queue , $ i * $ maxBatchSize , $ maxBatchSize )
228
+ \ array_slice ($ queue , $ i * $ maxBatchSize , $ maxBatchSize )
229
229
);
230
230
}
231
231
}
@@ -271,20 +271,20 @@ private function handleFailedDispatch(array $batch, \Exception $error)
271
271
*/
272
272
private function validateBatchPromiseOutput ($ values , $ keys )
273
273
{
274
- if (! is_array ($ values )) {
274
+ if (! \ is_array ($ values )) {
275
275
throw new DataLoaderException (
276
276
self ::class . ' must be constructed with a function which accepts ' .
277
277
'an array of keys and returns a Promise which resolves to an array of values ' .
278
- sprintf ('not return a Promise: %s. ' , gettype ($ values ))
278
+ \ sprintf ('not return a Promise: %s. ' , \ gettype ($ values ))
279
279
);
280
280
}
281
281
282
- if (count ($ values ) !== count ($ keys )) {
282
+ if (\ count ($ values ) !== \ count ($ keys )) {
283
283
throw new DataLoaderException (
284
284
self ::class . ' must be constructed with a function which accepts ' .
285
285
'an array of keys and returns a Promise which resolves to an array of values, but ' .
286
286
'the function did not return a Promise of an array of the same length as the array of keys. ' .
287
- sprintf ("\n Keys: %s \n Values: %s \n" , count ($ keys ), count ($ values ))
287
+ \ sprintf ("\n Keys: %s \n Values: %s \n" , \ count ($ keys ), \ count ($ values ))
288
288
);
289
289
}
290
290
}
0 commit comments