Documentation

Core_Registry
in package

Implement a Registry pattern

// Save value $value = 1; Core_Registry::instance()->set('My_Key', $value); // Get value $x = Core_Registry::instance()->get('My_Key'); // Delete value Core_Registry::instance()->delete('My_Key');
Tags
subpackage

Core

version
7.x
author

Hostmake LLC

copyright

© 2005-2022 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

$_instance  : mixed
The singleton instance.
$_values  : array<string|int, mixed>
List of values
delete()  : Core_Registry
Delete value for key
get()  : mixed
Get value for key
instance()  : object
Register an existing instance as a singleton.
set()  : Core_Registry
Set value for key
__construct()  : mixed
Constructor.

Properties

$_instance

The singleton instance.

private static mixed $_instance = \NULL

$_values

List of values

private array<string|int, mixed> $_values = array()

Methods

delete()

Delete value for key

public delete(string $key) : Core_Registry
$oCore_Registry = Core_Registry::instance(); $oCore_Registry->delete('My_Key');
Parameters
$key : string
Return values
Core_Registry

get()

Get value for key

public get(string $key[, string $defaultValue = NULL ]) : mixed
$oCore_Registry = Core_Registry::instance(); $value = $oCore_Registry->get('My_Key');
Parameters
$key : string

Key

$defaultValue : string = NULL

Default value

Return values
mixed

value or NULL

instance()

Register an existing instance as a singleton.

public static instance() : object
Return values
object

set()

Set value for key

public set(string $key, mixed $value) : Core_Registry
$oCore_Registry = Core_Registry::instance(); $value = 1; $oCore_Registry->set('My_Key', $value);
Parameters
$key : string
$value : mixed
Return values
Core_Registry

__construct()

Constructor.

protected __construct() : mixed
Return values
mixed

Search results