src/AbstractQueue.php
final public function ensureGetIndex(array $beforeSort = [], array $afterSort = [])
    {
        //using general rule: equality, sort, range or more equality tests in that order for index
        $completeFields = ['earliestGet' => 1];

        $this->verifySort($beforeSort, 'beforeSort', $completeFields);

        $completeFields['priority'] = 1;
        $completeFields['created'] = 1;

        $this->verifySort($afterSort, 'afterSort', $completeFields);

        //for the main query in get()
        $this->ensureIndex($completeFields);
    }
final public function ensureGetIndex(array $beforeSort = [], array $afterSort = [])
    {
        //using general rule: equality, sort, range or more equality tests in that order for index
        $completeFields = ['earliestGet' => 1];

        $this->verifySort($beforeSort, 'beforeSort', $completeFields);

        $completeFields['priority'] = 1;
        $completeFields['created'] = 1;

        $this->verifySort($afterSort, 'afterSort', $completeFields);

        //for the main query in get()
        $this->ensureIndex($completeFields);
    }
Ensure an index for the get() method.

@param array $beforeSort Fields in get() call to index before the sort field in same format
as \MongoDB\Collection::ensureIndex()
@param array $afterSort  Fields in get() call to index after the sort field in same format as
\MongoDB\Collection::ensureIndex()

@return void

@throws \InvalidArgumentException value of $beforeSort or $afterSort is not 1 or -1 for ascending and descending
@throws \InvalidArgumentException key in $beforeSort or $afterSort was not a string