From 63dc17d0abc398c135f6d049d28174c3925416c9 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Wed, 24 May 2023 05:06:01 +0300 Subject: forming default values for auto fields --- core/classes/Registry.php | 49 +++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'core/classes/Registry.php') diff --git a/core/classes/Registry.php b/core/classes/Registry.php index 047fd54..119e2b9 100644 --- a/core/classes/Registry.php +++ b/core/classes/Registry.php @@ -3,16 +3,18 @@ /** Registry * --- * - * Regisrty is a global repository of {key: value} pairs, - * where key is a friendly label, and... - * value can be anything (numbet|string|array|object etc) + * Regisrty is a global repository of { Key : Value } pairs, + * where Key is a friendly label, and... + * Value can be almost anything (number|string|array|object etc) * - * It has a central role in the framework. - * By default it holds the Request instance and several - * othe core instanses like database connections etc. + * Usually it has a central role in the framework; + * Can hold the Request instance and several other core instanses + * like database connections, cache services, etc. * - * It implements the Facade design pattern; - * it defines a new interface for existing objects. + * Designwise, Registry is a Singleton class + * implementing (both) the Singleton and the Facade design pattern + * allowing easy binding of core-singleton interfaces and objects + * into the application * * --- */ @@ -22,16 +24,23 @@ class Registry * ------------------------------------------------------------------------- */ - /** keeps all ready-to-use records - * --- - * These are all records defined via Registry::set(), and - * vow-records defined (Registry::vow()) AND called (Registry::use()) - * (it does not include the vows that have not carried-out yet ) + /** @var $records (array) + * keeps all ready-to-use records + * --- --- -- - - - + * + * These are set-records [defined via Registry::set()], + * or + * called vow-records [called via Registry::use()] + * + * NOTE: + * $records does not include the vows that have not carried-out yet */ private static $records = Array(); - /** keeps all records that will be carried-out later (if ever) - * --- + /** @var $wish (array) + * keeps all records that will be carried-out later (if ever) + * --- -- -- - - - + * * These are registered via Registry::vow() */ private static $wish = Array(); @@ -42,8 +51,9 @@ class Registry */ /** set - * --- + * --- -- -- - - - * store $data to the registry undel the label $key + * * @param $key (string) * @param $data * */ @@ -66,9 +76,10 @@ class Registry /** get - * --- + * --- -- - - - * get data from registry, * stored under the label $key + * * @param $key (string): the label * @return data (mixed) */ @@ -84,12 +95,12 @@ class Registry /** vow - * --- + * --- -- -- - - - * implements a promise of a function operation * when/if the registry label is called; * it can store a function, an object handler etc. * - * example: + * @example: * Registry::vow('key', function(){ return new Obj(); }) * * The main advantage of using a 'vow' vs a 'set' is -- cgit v1.2.3