Oihana PHP Arango

assertCursorOption.php

Table of Contents

Functions

assertCursorOption()  : void
Refuses a cursor option a caller may not name through `Arango::CURSOR_OPTIONS`, or a value of the wrong type.

Functions

assertCursorOption()

Refuses a cursor option a caller may not name through `Arango::CURSOR_OPTIONS`, or a value of the wrong type.

assertCursorOption(int|string $name, mixed $value) : void

Five options are a caller's : batchSize, memoryLimit and ttl (positive integers), maxRuntime (a positive number) and stream (a boolean). Every refusal is ours, since the server says nothing — an option it does not know and a value of the wrong type both run as if absent (measured on ArangoDB 3.12). A few names are refused with their reason : query / bindVars would replace the query the model builds, guards included ; fullCount is decided by the read from its LIMIT ; profile goes through Arango::PROFILE ; count is handed back by no read.

Parameters
$name : int|string

The option name.

$value : mixed

The option value.

Tags
throws
ValidationException

When the option is not one of the five, or its value is not of the expected type.

example
use oihana\arango\clients\cursor\enums\CursorField;
use function oihana\arango\models\helpers\assertCursorOption;

assertCursorOption( CursorField::BATCH_SIZE , 1000 ) ; // ✅ nothing thrown

assertCursorOption( 'batchsize' , 1000 ) ;
// ❌ ValidationException: Unknown cursor option "batchsize" — expected one of: batchSize, maxRuntime, memoryLimit, stream, ttl.

assertCursorOption( CursorField::TTL , -5 ) ;
// ❌ ValidationException: The cursor option "ttl" must be a positive integer, int given.
author

Marc Alcaraz (eKameleon)

version
1.0.0
On this page

Search results