THis piece of code returns only 4 results:
$searchString = "location:Tehran language:php";
$pager = new ResultPager($this->client);
return $pager->fetchAll($this->client->search(), 'users', [$searchString]);
The reason this is happening is the use of array_merge() on line 78 of ResultPager:
$result = array_merge($result, $this->fetchNext());
Since the search results are put in the items key of the returned result, it gets overridden using array_merge(). I unfortunately do not know enough about the GitHub API results to suggest an improvement, but maybe adding an optional argument to ResultPager::fetchAll() that would be the key that needs to be merged might help. For example, my call would look like this:
return $pager->fetchAll($this->client->search(), 'users', [$searchString], 'items');
One other thing that could help is to override values if they are not arrays, and merge them if they are.
THis piece of code returns only 4 results:
The reason this is happening is the use of
array_merge()on line 78 ofResultPager:Since the search results are put in the
itemskey of the returned result, it gets overridden usingarray_merge(). I unfortunately do not know enough about the GitHub API results to suggest an improvement, but maybe adding an optional argument toResultPager::fetchAll()that would be the key that needs to be merged might help. For example, my call would look like this:One other thing that could help is to override values if they are not arrays, and merge them if they are.