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 +++++++++++++++--------- core/classes/Request.php | 5 +-- core/classes/authentication/Core/UserManager.php | 7 +++- 3 files changed, 37 insertions(+), 24 deletions(-) (limited to 'core/classes') 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 diff --git a/core/classes/Request.php b/core/classes/Request.php index 89928f9..7f64d64 100644 --- a/core/classes/Request.php +++ b/core/classes/Request.php @@ -154,8 +154,5 @@ class Request // $this->userResolver = $callback; // return $this; } - - - + } - diff --git a/core/classes/authentication/Core/UserManager.php b/core/classes/authentication/Core/UserManager.php index 54cd2cb..4d9da7b 100644 --- a/core/classes/authentication/Core/UserManager.php +++ b/core/classes/authentication/Core/UserManager.php @@ -42,6 +42,8 @@ class UserManager implements UserManagerInterface /** hasUserToken() * == is user loged in * + * @param void + * @return boolean */ public function hasUserToken(): bool { @@ -55,9 +57,12 @@ class UserManager implements UserManagerInterface * checks if user is granded some role(s) * from the array of roles that are passed * - * ex. $token->isGranted(['editor', 'designer']) ... + * @example: + * $token->isGranted(['editor', 'designer']) ... * returns true if the user is editor or designer (or both) * + * @param $roles (array) : array of (int) role IDs + * @return boolean */ public function isGranted(array $roles): bool { -- cgit v1.2.3