GRIS_STATE
in package
Class to manage all states in the system (used as a sinbgleton pattern)
With this class all states can be managed and returned for messages ans debug USAGE: $singleton = Singleton::getInstance();
PHP version 7
Copyright (c) 2016, Holger Heuser
Tags
Table of Contents
- settings_group = "state"
- The constant for the settings group
- $instance : object
- The instance counter
- $logger : object
- The logger object
- $state : array<string|int, mixed>
- The current state data
- __construct() : mixed
- The class constructor
- clear() : mixed
- Clear all states
- get() : array<string|int, mixed>
- Get method for states
- get_last() : array<string|int, mixed>
- Get last state
- getInstance() : mixed
- The instance creator
- set() : mixed
- Set method for states
- __clone() : mixed
- The instance creator
Constants
settings_group
The constant for the settings group
public
mixed
settings_group
= "state"
Properties
$instance
The instance counter
private
static object
$instance
= NULL
Tags
$logger
The logger object
private
object
$logger
Tags
$state
The current state data
private
array<string|int, mixed>
$state
Tags
Methods
__construct()
The class constructor
public
__construct() : mixed
Initializes the objects
Return values
mixed —clear()
Clear all states
public
clear() : mixed
Removes all states from the list
Return values
mixed —get()
Get method for states
public
get([string $level = NULL ][, mixed $short = true ]) : array<string|int, mixed>
Parameters
- $level : string = NULL
-
Return a special level (e.g. ERROR) or all states if NULL
- $short : mixed = true
Return values
array<string|int, mixed> —Returns the current states.
get_last()
Get last state
public
get_last() : array<string|int, mixed>
Return values
array<string|int, mixed> —Return the current states.
getInstance()
The instance creator
public
static getInstance() : mixed
Returns an instance of the object
Return values
mixed —set()
Set method for states
public
set(string $type, string $message[, string $function = NULL ]) : mixed
Parameters
- $type : string
-
The type of the state
- $message : string
-
The message text
- $function : string = NULL
-
The function where it appeared (e. g. CLASS::function)
Sets the current state and send it to the log
Return values
mixed —__clone()
The instance creator
private
__clone() : mixed
Prohibits external cloning of the object