private function normalize($selection)
    {
        if (isset($selection['query'])) {
            return ['query' => $selection['query']];
        }

        if (is_string($selection) || (is_array($selection) && isset($selection[0]))) {
            return ['id' => $selection];
        }

        $selectionOpts = implode(PHP_EOL, [
            '',
            '* Document ID (<docId>)',
            '* Array of document IDs',
            '* Array containing "query"',
        ]);

        throw new InvalidArgumentException('Invalid selection, must be one of: ' . $selectionOpts);
    }
private function normalize($selection)
    {
        if (isset($selection['query'])) {
            return ['query' => $selection['query']];
        }

        if (is_string($selection) || (is_array($selection) && isset($selection[0]))) {
            return ['id' => $selection];
        }

        $selectionOpts = implode(PHP_EOL, [
            '',
            '* Document ID (<docId>)',
            '* Array of document IDs',
            '* Array containing "query"',
        ]);

        throw new InvalidArgumentException('Invalid selection, must be one of: ' . $selectionOpts);
    }
private function normalize ( $ selection ) { if ( isset ( $ selection [ 'query' ] ) ) { return [ 'query' => $ selection [ 'query' ] ] ; } if ( is_string ( $ selection ) || ( is_array ( $ selection ) && isset ( $ selection [ 0 ] ) ) ) { return [ 'id' => $ selection ] ; } $ selectionOpts = implode ( PHP_EOL , [ '' , '* Document ID (<docId>)' , '* Array of document IDs' , '* Array containing "query"' , ] ) ; throw new InvalidArgumentException ( 'Invalid selection, must be one of: ' . $ selectionOpts ) ; }
Validates and normalizes a selection

@return array
@throws InvalidArgumentException
Validates and normalizes a selection