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

__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.

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.

Details

__construct(IConnection $instance, IOptions $optionsHandler, IArgumentsStrategy $argumentsStrategy)

Constructor for AbstractArguments.

Parameters

IConnection $instance

The connection instance to use

IOptions $optionsHandler

The options handler instance to use

IArgumentsStrategy $argumentsStrategy

The arguments strategy instance to use

static IConnection getInstance()

Get the connection instance.

Return Value

IConnection

The connection instance.

static IOptions getOptionsHandler()

Get the options handler instance.

Return Value

IOptions

The option's handler.

static IArgumentsStrategy getArgumentsStrategy()

Get the arguments strategy instance.

Return Value

IArgumentsStrategy

The argument's strategy.

static string|int|bool setType(mixed $value)

Determines the type that will receive treatment

Parameters

mixed $value

The value to set the argument type to.

Return Value

string|int|bool

The set argument type.

static array setConstant(array $value)

Transform variables in constants

Parameters

array $value

Return Value

array

static IConnection callArgumentsByFormat(string $format, mixed $arguments)

Determines arguments type by calling to format type

Parameters

string $format

The format to call the arguments by.

mixed $arguments

The arguments to call.

Return Value

IConnection

The connection instance.

static IConnection callWithByStaticArgs(array $arguments)

This method is used when all parameters are used in the static arguments format

Parameters

array $arguments

The arguments to call with.

Return Value

IConnection

The connection instance.

IConnection|string|int|bool|array|null call(string $name, array $arguments)

Triggered when invoking inaccessible methods in an object context

Parameters

string $name

The name to call with.

array $arguments

The arguments to call with.

Return Value

IConnection|string|int|bool|array|null

The result of the call.

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.

Parameters

string $name

The name to call statically with.

array $arguments

The arguments to call statically with.

Return Value

IConnection|string|int|bool|array|null

The result of the static call.