diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-24 05:06:01 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-24 05:06:01 +0300 |
| commit | 63dc17d0abc398c135f6d049d28174c3925416c9 (patch) | |
| tree | 3c68552b737096b073368ac8d874b0cd46640adb /core/classes/Registry.php | |
| parent | 2f5f034a97fd39b372d9c23b1b04db74c4469f22 (diff) | |
| download | gyraf1gov-63dc17d0abc398c135f6d049d28174c3925416c9.tar.gz gyraf1gov-63dc17d0abc398c135f6d049d28174c3925416c9.tar.bz2 gyraf1gov-63dc17d0abc398c135f6d049d28174c3925416c9.zip | |
forming default values for auto fields
Diffstat (limited to 'core/classes/Registry.php')
| -rw-r--r-- | core/classes/Registry.php | 49 |
1 files changed, 30 insertions, 19 deletions
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 |
