abstract class AbstractAttributes implements IAttributesAbstract (View source)

The GenericDatabase\Abstract\AbstractAttributes class implements the IAttributesAbstract interface and serves as a base class for defining attributes in the PHP-Generic-Database project. It provides a common interface and shared functionality for all attribute classes.

This class provides a structure for managing dynamic properties using a connection instance and options handler. It allows setting and getting properties dynamically by utilizing the Run::call method to invoke methods on the connection instance.

Main functionalities:

  • Manages the connection instance and options handler.
  • Provides a base implementation for defining attributes in the PHP-Generic-Database project.
  • Allows dynamic setting and getting of attribute values.
  • Provides a common interface for all attribute classes.

Methods:

  • getInstance(): IConnection: Returns the static instance of IConnection.
  • getOptionsHandler(): IOptions: Returns the static instance of IOptions.
  • set(string $name, mixed $value): void: Sets a property dynamically on the connection instance.
  • get(string $name): mixed: Retrieves a property dynamically from the connection instance.

Fields:

  • $instance: The connection instance used for dynamic operations.
  • $optionsHandler: The options handler for managing configuration.

Properties

static protected IConnection $instance
static protected IOptions $optionsHandler

Methods

__construct(IConnection $instance, IOptions $optionsHandler)

Constructor for AbstractAttributes.

getInstance()

Get the connection instance.

getOptionsHandler()

Get the options handler instance.

void
set(string $name, mixed $value)

Set an attribute value using dynamic method call.

mixed
get(string $name)

Get an attribute value using dynamic method call.

Details

__construct(IConnection $instance, IOptions $optionsHandler)

Constructor for AbstractAttributes.

Parameters

IConnection $instance

The connection instance to use

IOptions $optionsHandler

The options handler instance to use

IConnection getInstance()

Get the connection instance.

Return Value

IConnection

The current connection instance

IOptions getOptionsHandler()

Get the options handler instance.

Return Value

IOptions

The current options handler instance

void set(string $name, mixed $value)

Set an attribute value using dynamic method call.

Parameters

string $name

The name of the attribute to set

mixed $value

The value to set

Return Value

void

mixed get(string $name)

Get an attribute value using dynamic method call.

Parameters

string $name

The name of the attribute to get

Return Value

mixed

The value of the requested attribute