AbstractArguments
abstract class AbstractArguments implements IArgumentsAbstract (View source)
The GenericDatabase\Abstract\AbstractArguments class is an abstract class implements the IArgumentsAbstract interface and that provides a framework for handling database connection arguments.
It manages static instances of IConnection, IOptions, and IArgumentsStrategy and provides methods to manipulate and retrieve these instances and manages static instances of IConnection, IOptions, and IArgumentsStrategy, and provides methods to manipulate and retrieve these instances. It includes functionality for setting types, transforming variables into constants, and handling arguments in various formats such as JSON, XML, INI, and YAML. The class also supports dynamic method invocation and acts as a factory for instantiating classes with specific arguments.
Main functionalities:
- Manages static instances of IConnection, IOptions, and IArgumentsStrategy.
- Provides methods for setting types, transforming variables into constants, and handling arguments in various formats.
- Supports dynamic method invocation and acts as a factory for instantiating classes with specific arguments.
- Offers a flexible and extensible framework for handling database connection arguments.
Methods:
getInstance(): IConnection:Returns the static instance of IConnection.getOptionsHandler(): IOptions:Returns the static instance of IOptions.getArgumentsStrategy(): IArgumentsStrategy:Returns the static instance of IArgumentsStrategy.setType(mixed $value): string|int|bool:Determines the type of value and returns it as a string, int, or bool.setConstant(array $value): array:Transforms variables into constants.callArgumentsByFormat(string $format, mixed $arguments):IConnection: Determines the type of arguments based on the format (json, xml, ini, or yaml) and sets the corresponding values in the IConnection instance.callWithByStaticArray(array $arguments): IConnection:Sets values in the IConnection instance using a static array format.callWithByStaticArgs(array $arguments): IConnection:Same as callWithByStaticArray, but with a different name.call(string $name, array $arguments): IConnection|string|int|bool|array|null:Triggers when invoking inaccessible methods in an object context. It sets or gets values in the IConnection instance based on the method name.callStatic(string $name, array $arguments): IConnection|string|int|bool|array|null:Works like a factory, identifying the way the class is instantiated and its arguments. It calls the corresponding method based on the name and arguments.
Fields:
$instance: The connection instance used for dynamic operations.$optionsHandler: The options handler for managing configuration.$argumentsStrategy: The arguments strategy handler for managing configuration.
Properties
| static protected IConnection | $instance | ||
| static protected IOptions | $optionsHandler | ||
| static protected IArgumentsStrategy | $argumentsStrategy |
Methods
Constructor for AbstractArguments.
Get the connection instance.
Get the options handler instance.
Get the arguments strategy instance.
Determines the type that will receive treatment
Transform variables in constants
Determines arguments type by calling to format type
This method is used when all parameters are used in the static arguments format
Triggered when invoking inaccessible methods in an object context
This method works like a factory and is responsible for identifying the way in which the class is instantiated, as well as its arguments.
Details
__construct(IConnection $instance, IOptions $optionsHandler, IArgumentsStrategy $argumentsStrategy)
Constructor for AbstractArguments.
static IConnection
getInstance()
Get the connection instance.
static IOptions
getOptionsHandler()
Get the options handler instance.
static IArgumentsStrategy
getArgumentsStrategy()
Get the arguments strategy instance.
static string|int|bool
setType(mixed $value)
Determines the type that will receive treatment
static array
setConstant(array $value)
Transform variables in constants
static IConnection
callArgumentsByFormat(string $format, mixed $arguments)
Determines arguments type by calling to format type
static IConnection
callWithByStaticArgs(array $arguments)
This method is used when all parameters are used in the static arguments format
IConnection|string|int|bool|array|null
call(string $name, array $arguments)
Triggered when invoking inaccessible methods in an object context
static IConnection|string|int|bool|array|null
callStatic(string $name, array $arguments)
This method works like a factory and is responsible for identifying the way in which the class is instantiated, as well as its arguments.