From d6528d9c3801d8daebaf47bd50a150b4eb83ea06 Mon Sep 17 00:00:00 2001 From: Andreas Hennings Date: Tue, 11 Feb 2014 18:02:01 +0100 Subject: [PATCH] Add @todo tags in CRM_Utils_Request and CRM_Utils_Type. --- CRM/Utils/Request.php | 7 ++++++- CRM/Utils/Type.php | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Request.php b/CRM/Utils/Request.php index c872163da2..5d3779bcff 100644 --- a/CRM/Utils/Request.php +++ b/CRM/Utils/Request.php @@ -44,11 +44,16 @@ class CRM_Utils_Request { * pattern and cache the instance in this variable * * @var self + * + * @todo Unused private property can be safely removed. */ static private $_singleton = NULL; /** - * Class constructor + * Constructor. + * + * @todo Empty constructor can be safely removed. + * @todo Class is not meant to be instantiated. */ public function __construct() {} diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php index 8751442958..af4082058a 100644 --- a/CRM/Utils/Type.php +++ b/CRM/Utils/Type.php @@ -51,6 +51,7 @@ class CRM_Utils_Type { T_CCNUM = 8192, T_MEDIUMBLOB = 16384; + // @todo What's the point of these constants? Backwards compatibility? const TWO = 2, FOUR = 4, @@ -75,6 +76,9 @@ class CRM_Utils_Type { * String identifying the data type, e.g. 'Int' or 'String'. */ public static function typeToString($type) { + // @todo Use constants in the case statements, e.g. "case T_INT:". + // @todo return directly, instead of assigning a value. + // @todo Use a lookup array, as a property or as a local variable. switch ($type) { case 1: $string = 'Int'; @@ -167,6 +171,8 @@ class CRM_Utils_Type { // Checked for multi valued state/country value if (is_array($data)) { $returnData = TRUE; + // @todo Reuse of the $data variable = asking for trouble. + // @todo This code will always return the last item in the array. Intended? foreach ($data as $data) { if (CRM_Utils_Rule::positiveInteger($data) || CRM_Core_DAO::escapeString($data)) { $returnData = TRUE; @@ -248,6 +254,7 @@ class CRM_Utils_Type { break; } + // @todo Use exceptions instead of CRM_Core_Error::fatal(). if ($abort) { $data = htmlentities($data); CRM_Core_Error::fatal("$data is not of the type $type"); -- 2.25.1