\Omega\Support\Facade AliasLoader

Class AliasLoader.

The AliasLoader class is responsible for managing and loading class aliases within the application. It simplifies the process of creating aliases for classes, allowing developers to reference them with shorter or more meaningful names. By utilizing the load method, all specified aliases can be registered at once, enhancing code readability and maintainability.

This class follows the singleton pattern by providing a static getInstance method to instantiate the loader with a given set of aliases.

Summary

Methods
Properties
Constants
__construct
load
getInstance
No public properties found
No public constants found
No protected methods found
aliases
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$aliases

$aliases : array

Type

array<string|int, mixed>

Methods

__construct()

__construct(array  $aliases) : void

Create a new AliasLoader instance.

Parameters

array $aliases

Holds an associative array where the keys are the alias names and the values are the fully qualified class names.

Returns

void —

load()

load() : void

Load the class aliases.

This method registers all class aliases defined in the aliases array by creating an alias for each class. It uses the PHP built-in class_alias function to establish the aliasing relationship.

Returns

void —

getInstance()

getInstance(array  $aliases) : \Omega\Support\Facade\AliasLoader

Get an instance of AliasLoader.

This static method returns a new instance of the AliasLoader class, initialized with the provided aliases. This method allows for convenient creation of an AliasLoader instance without the need to instantiate it directly.

Parameters

array $aliases

Holds a associative array where the keys are the alias names and the values are the fully qualified class names.

Returns

\Omega\Support\Facade\AliasLoader —

Returns a new instance of AliasLoader.