getDocuments.php
Table of Contents
Functions
- getDocuments() : Documents|null
- Resolves a {@see Documents} instance from various types of input definitions.
Functions
getDocuments()
Resolves a {@see Documents} instance from various types of input definitions.
getDocuments([array<string|int, mixed>|string|Documents|null $definition = null ][, ContainerInterface|null $container = null ][, string $key = Arango::DOCUMENTS ][, Documents|null $default = null ]) : Documents|null
This helper function returns a Documents object from: a direct instance, an array definition, a service name within a PSR-11 container, or falls back to a provided default value.
Behavior:
- If
$definitionis a Documents instance, it is returned as-is. - If
$definitionis an array, the function looks for the$key(default: Arango::DOCUMENTS). - If
$definitionis a non-empty string and$containercontains a service with that name, the corresponding service is fetched. - If none of the above conditions are met, the
$defaultvalue is returned.
Parameters
- $definition : array<string|int, mixed>|string|Documents|null = null
-
Input definition that may represent an
Documentsinstance, an associative array containing one, or a container service name. - $container : ContainerInterface|null = null
-
Optional PSR-11 container used to resolve string service names.
- $key : string = Arango::DOCUMENTS
-
Array key to look for when
$definitionis an array - $default : Documents|null = null
-
Default
Documentsinstance to return if resolution fails. (defaults to Arango::DOCUMENTS).
Tags
Return values
Documents|null —Returns the resolved Documents instance or the default value if not found.