@@ -76,7 +76,7 @@ function (callable $resolve, callable $reject) use ($key) {
7676 'reject ' => $ reject ,
7777 ];
7878
79- if (count ($ this ->promiseQueue ) === 1 ) {
79+ if (\ count ($ this ->promiseQueue ) === 1 ) {
8080 $ this ->scheduleDispatch ();
8181 }
8282 }
@@ -95,7 +95,7 @@ function (callable $resolve, callable $reject) use ($key) {
9595 public function loadMany (array $ keys )
9696 {
9797 return \React \Promise \all (
98- array_map (
98+ \ array_map (
9999 function ($ key ) {
100100 return $ this ->load ($ key );
101101 },
@@ -187,17 +187,17 @@ private function dispatchQueue()
187187 */
188188 private function dispatchQueueBatch ($ batch )
189189 {
190- $ keys = array_column ($ batch , 'key ' );
190+ $ keys = \ array_column ($ batch , 'key ' );
191191 $ batchLoadFunction = $ this ->batchLoadFunction ;
192192
193193 /** @var Promise $batchPromise */
194194 $ batchPromise = $ batchLoadFunction ($ keys );
195195
196- if (! $ batchPromise || ! is_callable ([$ batchPromise , 'then ' ])) {
196+ if (! $ batchPromise || ! \ is_callable ([$ batchPromise , 'then ' ])) {
197197 return $ this ->handleFailedDispatch ($ batch , new DataLoaderException (
198198 self ::class . ' must be constructed with a function which accepts ' .
199199 '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 ))
201201 ));
202202 }
203203
@@ -221,11 +221,11 @@ function ($values) use ($batch, $keys) {
221221 */
222222 private function dispatchQueueInMultipleBatches (array $ queue , $ maxBatchSize )
223223 {
224- $ numberOfBatchesToDispatch = count ($ queue ) / $ maxBatchSize ;
224+ $ numberOfBatchesToDispatch = \ count ($ queue ) / $ maxBatchSize ;
225225
226226 for ($ i = 0 ; $ i < $ numberOfBatchesToDispatch ; $ i ++) {
227227 $ this ->dispatchQueueBatch (
228- array_slice ($ queue , $ i * $ maxBatchSize , $ maxBatchSize )
228+ \ array_slice ($ queue , $ i * $ maxBatchSize , $ maxBatchSize )
229229 );
230230 }
231231 }
@@ -271,20 +271,20 @@ private function handleFailedDispatch(array $batch, \Exception $error)
271271 */
272272 private function validateBatchPromiseOutput ($ values , $ keys )
273273 {
274- if (! is_array ($ values )) {
274+ if (! \ is_array ($ values )) {
275275 throw new DataLoaderException (
276276 self ::class . ' must be constructed with a function which accepts ' .
277277 '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 ))
279279 );
280280 }
281281
282- if (count ($ values ) !== count ($ keys )) {
282+ if (\ count ($ values ) !== \ count ($ keys )) {
283283 throw new DataLoaderException (
284284 self ::class . ' must be constructed with a function which accepts ' .
285285 'an array of keys and returns a Promise which resolves to an array of values, but ' .
286286 '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 ))
288288 );
289289 }
290290 }
0 commit comments