model/modx/registry/modregistry.class.php
- package
- modx
- subpackage
- registry
- todo
- Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.
- Classes
- modRegistry
Description
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.
\modRegistry
- package
- modx
- subpackage
- registry
- todo
- Encapsulate all debugging, error handling, error reporting, and audit logging features into appropriate registers.
- Properties
- $_invalidKeys
- $_loggingRegister
- $_options
- $_prevLogLevel
- $_prevLogTarget
- $_registers
- $modx
- Methods
- __construct
- _initRegister
- addRegister
- getRegister
- isLogging
- removeRegister
- resetLogging
- setLogging
Description
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.
Properties
$_invalidKeys
array $_invalidKeys = 'array'
An array of register keys that are reserved from use.
Details
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
- access
- protected
$_loggingRegister
\modRegister $_loggingRegister = 'null'
Details
-
\modRegister
The current logging registry - visibility
- protected
- default
- null
- final
- false
- static
- false
$_options
array $_options = 'array'
An array of global options applied to the registry.
Details
- array
- visibility
- public
- default
- array
- final
- false
- static
- false
- access
- protected
$_prevLogLevel
integer $_prevLogLevel = 'null'
Details
- integer
The previous log level for xPDO, to be reset when finished - visibility
- protected
- default
- null
- final
- false
- static
- false
$_prevLogTarget
string $_prevLogTarget = 'null'
Details
- string
The previous logTarget for xPDO, to be reset when finished - visibility
- protected
- default
- null
- final
- false
- static
- false
$_registers
array $_registers = 'array'
An array of MODX registers managed by the registry.
Details
- array
- visibility
- protected
- default
- array
- final
- false
- static
- false
- access
- private
$modx
Methods
__construct
__construct(
\modX $modx, array $options
=
array
)
:
Construct a new registry instance.
Arguments
- $modx
- \modX
&$modx A reference to a modX instance. - $options
- array
Optional array of registry options.
Details
- visibility
- public
- final
- false
- static
- false
_initRegister
_initRegister(
string $key, string $class, array $options
=
array
)
:
\modRegister
Initialize a register within the registry.
Arguments
- $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.
Output
- \modRegister
- The register instance.
Details
- visibility
- protected
- final
- false
- static
- false
- access
- protected
addRegister
addRegister(
string $key, string $class, array $options
=
array
)
:
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.
Arguments
- $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
- visibility
- public
- final
- false
- static
- false
- access
- public
getRegister
getRegister(
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.
Arguments
- $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.
Output
- \modRegister
- A modRegister instance.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
isLogging
isLogging(
)
:
boolean
Check if logging is currently active
Output
- boolean
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
removeRegister
removeRegister(
string $key
)
:
Remove a modRegister instance from the registry.
Arguments
- $key
- string
The unique name of the register to remove.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
resetLogging
resetLogging(
)
:
Reset the current logging.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
setLogging
setLogging(
\modRegister $register, string $topic, int $level
=
modX
)
:
boolean
Set the logging level for the topic.
Arguments
- $register
- \modRegister
&$register - $topic
- string
- $level
- int
Output
- boolean
- True if successful.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public