Locker\Repository\Statement\IndexOptions::validate PHP Метод

validate() защищенный Метод

Validates the given options as index options.
protected validate ( $opts ) : [String
Результат [String
    protected function validate($opts)
    {
        $opts = parent::validate($opts);
        // Validates values.
        if (!isset($opts['lrs_id'])) {
            throw new Exceptions\Exception('`lrs_id` must be set.');
        }
        if ($opts['offset'] < 0) {
            throw new Exceptions\Exception('`offset` must be a positive interger.');
        }
        if ($opts['limit'] < 1) {
            throw new Exceptions\Exception('`limit` must be a positive interger.');
        }
        if (!in_array($opts['format'], ['exact', 'canonical', 'ids'])) {
            throw new Exceptions\Exception('`format` must be "exact", "canonical", or "ids".');
        }
        return $opts;
    }