core/model/modx/registry/modregistry.class.php

Show: inherited
Table of Contents

Represents a collection of message registers.

A register can consist of loggable audit events, error events, debug events, and any other messages that may be sent to a message queue and later retrieved or redirected to some other output source. Some key features will include:

-Logging of registry transactions to file or DB -Tracking progress of asynchonous processes -Can serve as a generic message queue, where MODX elements can register new messages or grab the latest messages via scheduled or ad hoc requests.

Package
modx  
Subpackage
registry  
Todo
Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.  

\modRegistry

Package: modx\registry

Represents a collection of message registers.

A register can consist of loggable audit events, error events, debug events, and any other messages that may be sent to a message queue and later retrieved or redirected to some other output source. Some key features will include:

-Logging of registry transactions to file or DB -Tracking progress of asynchonous processes -Can serve as a generic message queue, where MODX elements can register new messages or grab the latest messages via scheduled or ad hoc requests.

Todo
Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.  

Properties

Propertyprotectedarray  $_invalidKeys= 'array( 'modx', )'

An array of register keys that are reserved from use.

Default valuearray( 'modx', )Details
Type
array
Access
protected  
Propertyprotected\modRegister  $_loggingRegister= 'null'

The current logging registry
Default valuenullDetails
Type
\modRegister
Propertypublicarray  $_options= 'array()'

An array of global options applied to the registry.

Default valuearray()Details
Type
array
Access
protected  
Propertyprotectedinteger  $_prevLogLevel= 'null'

The previous log level for xPDO, to be reset when finished
Default valuenullDetails
Type
integer
Propertyprotectedstring  $_prevLogTarget= 'null'

The previous logTarget for xPDO, to be reset when finished
Default valuenullDetails
Type
string
Propertyprotectedarray  $_registers= 'array()'

An array of MODX registers managed by the registry.

Default valuearray()Details
Type
array
Access
private  
Propertypublic\modX  $modx= 'null'

A reference to the modX instance the registry is loaded by.

Default valuenullDetails
Type
\modX
Access
public  

Methods

methodpublic__construct( \modX $modx, array $options = array() ) : void

Construct a new registry instance.

Parameters
Name Type Description
$modx \modX

&$modx A reference to a modX instance.

$options array

Optional array of registry options.

methodprotected_initRegister( string $key, string $class, array $options = array() ) : \modRegister

Initialize a register within the registry.

Parameters
Name Type Description
$key string

The key of the registry

$class string

The class of the modRegister implementation to initialize.

$options array

An optional array of register options.

Returns
Type Description
\modRegister The register instance.
Details
Access
protected  
methodpublicaddRegister( string $key, string $class, array $options = array() ) : void

Add a modRegister instance to the registry.

Once a register is added, it is available directly from this registry instance by the key provided, e.g. $registry->key.

Parameters
Name Type Description
$key string

A unique name for the register in the registry. Must be a valid PHP variable string.

$class string

The actual modRegister derivative which implements the register functionality.

$options array

An optional array of register options.

Details
Access
public  
methodpublicgetRegister( string $key, string $class, array $options = array() ) : \modRegister

Get a modRegister instance from the registry.

If the register does not exist, it is added to the registry.

Parameters
Name Type Description
$key string

A unique name for the register in the registry. Must be a valid PHP variable string.

$class string

The actual modRegister derivative which implements the register functionality.

$options array

An optional array of register options.

Returns
Type Description
\modRegister A modRegister instance.
Details
Access
public  
methodpublicisLogging( ) : boolean

Check if logging is currently active

Returns
Type Description
boolean
Details
Access
public  
methodpublicremoveRegister( string $key ) : void

Remove a modRegister instance from the registry.

Parameters
Name Type Description
$key string

The unique name of the register to remove.

Details
Access
public  
methodpublicresetLogging( ) : void

Reset the current logging.

Details
Access
public  
methodpublicsetLogging( \modRegister $register, string $topic, int $level = modX::LOG_LEVEL_ERROR ) : boolean

Set the logging level for the topic.

Parameters
Name Type Description
$register \modRegister

&$register

$topic string
$level int
Returns
Type Description
boolean True if successful.
Details
Access
public  
Documentation was generated by DocBlox 0.18.1.