Loader

Loader of class instances based on dependency structure defined in an XML configuration file.

package

Default

Methods

Initialize the loader obect during creating an instance.

__construct(\Dotpay\Loader\Parser|null $current = null, \Dotpay\Loader\Parser|null $default = null) 

Arguments

$current

\Dotpay\Loader\Parser|null

The current parsed XML file with dependency structure

$default

\Dotpay\Loader\Parser|null

The default parsed XML file with dependency structure

Return an object which class name or alias is given.

findObject(string $name) : object
Throws
\Dotpay\Exception\Loader\EmptyObjectNameException

Thrown when object name is empty

\Dotpay\Exception\Loader\ObjectNotFoundException

Thrown when object with the given name is not found

Arguments

$name

string

A class name or an alias of an object

Response

object

Get the object which is identified by the name and initialized with the given set of params.

get(string $name, array $params = array()) : object|null

Arguments

$name

string

A class name or an alias of an object which is returned

$params

array

Set of params which is used to an initialization

Response

object|null

Return an instance of object which is represented by the given Object, instantiated using the given param list.

getObjectInstance(object $object, array $params = array()) : object|null

Arguments

$object

object

The Object instance which describes returned object

$params

array

The param list

Response

object|null

Initialize the loader object with the given data.

initialize(\Dotpay\Loader\Parser|null $current = null, \Dotpay\Loader\Parser|null $default = null) 

Arguments

$current

\Dotpay\Loader\Parser|null

The current parsed XML file with dependency structure

$default

\Dotpay\Loader\Parser|null

The default parsed XML file with dependency structure

Load the loader with given configuration.

load(\Dotpay\Loader\Parser|null $current = null, \Dotpay\Loader\Parser|null $default = null) : \Dotpay\Loader\Loader
static

Arguments

$current

\Dotpay\Loader\Parser|null

The current parsed XML file with dependency structure

$default

\Dotpay\Loader\Parser|null

The default parsed XML file with dependency structure

Response

\Dotpay\Loader\Loader

Return the object which represents an object which name and alias is given and which is initialized by using the given parameter list.

object(string $className, array $params = array(), string|null $alias = null) : object

Arguments

$className

string

The class name of the object

$params

array

The arameter list

$alias

string|null

The alias of the object

Response

object

Set a value of the parameter which is identified by class name and parameter name.

parameter(string $name, mixed $value) : object

Return the Object whose value has been set.

Throws
\Dotpay\Exception\Loader\ParamNotFoundException

Arguments

$name

string

A name of the parameter, which is composed of a class name and a parameter name, separated by ":" character

$value

mixed

A value of the parameter

Response

object

Set the given object with the given name and alias.

set(string $className, object $object, string|null $alias = null) : object

Return the Object which represents the given object.

Arguments

$className

string

Class name of the given object

$object

object

The object which is set

$alias

string|null

Alias of the given object

Response

object

Unload data stored in the Loader.

unload() 
static

Update objects which are stored in the loader.

updateObjects(array $objects) 

Arguments

$objects

array

A set of new objects

Properties

An instance of the Loader class

instance : \Dotpay\Loader\Loader|null
static
var

An instance of the Loader class

Type(s)

\Dotpay\Loader\Loader|null

List of Object elements which can contain instantiated objects. Keys are class names

objects : array
var

List of Object elements which can contain instantiated objects. Keys are class names

Type(s)

array

List of Object elements which can contain instantiated objects. Keys are aliases

aliases : array
var

List of Object elements which can contain instantiated objects. Keys are aliases

Type(s)

array