Oihana PHP Arango

assertBindVariable.php

Table of Contents

Functions

assertBindVariable()  : void
Asserts that the provided string is a valid ArangoDB bind variable name.

Functions

assertBindVariable()

Asserts that the provided string is a valid ArangoDB bind variable name.

assertBindVariable(string|null $to) : void

A valid bind variable:

  • May optionally start with '@'
  • Must start with a letter (a-zA-Z) or underscore '_'
  • Subsequent characters can be letters, digits, or underscores

Null is considered valid and ignored.

Valid examples:

  • @userId
  • foo
  • _bar123

Invalid examples:

  • 123abc (starts with a digit)
  • @!invalid (invalid character '!')
  • user-id (hyphen not allowed)
Parameters
$to : string|null

The bind variable to validate. Null is allowed.

Tags
throws
BindException

if the string is not a valid bind variable

example
assertBindVariable('@userId');   // ✅ no exception
assertBindVariable('foo');       // ✅ no exception
assertBindVariable('123abc');    // ❌ throws BindException
assertBindVariable('@!invalid'); // ❌ throws BindException
assertBindVariable(null);        // ✅ no exception
since
1.0.0
author

Marc Alcaraz

On this page

Search results