From ac89b2dc44666e9496ed60d0d93d51fca95c0b91 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Mon, 19 Nov 2018 11:28:38 +0100 Subject: [PATCH] Code cleanup --- application/applicationcontext.class.inc.php | 102 +++++++++++++------ 1 file changed, 71 insertions(+), 31 deletions(-) diff --git a/application/applicationcontext.class.inc.php b/application/applicationcontext.class.inc.php index 1f0fe8e94..30b2662ed 100644 --- a/application/applicationcontext.class.inc.php +++ b/application/applicationcontext.class.inc.php @@ -1,5 +1,5 @@ aNames = array( @@ -89,10 +119,11 @@ class ApplicationContext } } - + /** * Read the context directly in the PHP parameters (either POST or GET) - * return nothing + * + * @throws \Exception */ protected function ReadContext() { @@ -131,10 +162,13 @@ class ApplicationContext } $this->aValues = self::$aDefaultValues; } - + /** * Returns the current value for the given parameter + * * @param string $sParamName Name of the parameter to read + * @param string $defaultValue + * * @return mixed The value for this parameter */ public function GetCurrentValue($sParamName, $defaultValue = '') @@ -148,7 +182,7 @@ class ApplicationContext /** * Returns the context as string with the format name1=value1&name2=value2.... - * return string The context as a string to be appended to an href property + * @return string The context as a string to be appended to an href property */ public function GetForLink() { @@ -162,7 +196,7 @@ class ApplicationContext /** * Returns the context as sequence of input tags to be inserted inside a
tag - * return string The context as a sequence of tags + * @return string The context as a sequence of tags */ public function GetForForm() { @@ -176,7 +210,7 @@ class ApplicationContext /** * Returns the context as a hash array 'parameter_name' => value - * return array The context information + * @return array The context information */ public function GetAsHash() { @@ -199,8 +233,7 @@ class ApplicationContext /** * Removes the specified parameter from the context, for example when the same parameter * is already a search parameter - * @param string $sParamName Name of the parameter to remove - * @return none + * @param string $sParamName Name of the parameter to remove */ public function Reset($sParamName) { @@ -212,6 +245,11 @@ class ApplicationContext /** * Initializes the given object with the default values provided by the context + * + * @param \DBObject $oObj + * + * @throws \Exception + * @throws \CoreUnexpectedValue */ public function InitObjectFromContext(DBObject &$oObj) { @@ -238,15 +276,13 @@ class ApplicationContext } } } - - static $m_sUrlMakerClass = null; /** * Set the current application url provider - * @param sClass string Class implementing iDBObjectURLMaker - * @return void + * @param string $sClass Class implementing iDBObjectURLMaker + * @return string */ - public static function SetUrlMakerClass($sClass = 'iTopStandardURLMaker') + static public function SetUrlMakerClass($sClass = 'iTopStandardURLMaker') { $sPrevious = self::GetUrlMakerClass(); @@ -260,7 +296,7 @@ class ApplicationContext * Get the current application url provider * @return string the name of the class */ - public static function GetUrlMakerClass() + static public function GetUrlMakerClass() { if (is_null(self::$m_sUrlMakerClass)) { @@ -278,7 +314,14 @@ class ApplicationContext /** * Get the current application url provider + * + * @param string $sObjClass + * @param string $sObjKey + * @param null $sUrlMakerClass + * @param bool $bWithNavigationContext + * * @return string the name of the class + * @throws \Exception */ public static function MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass = null, $bWithNavigationContext = true) { @@ -306,13 +349,11 @@ class ApplicationContext } } - protected static $m_aPluginProperties = null; - /** * Load plugin properties for the current session * @return void */ - protected static function LoadPluginProperties() + static protected function LoadPluginProperties() { if (isset($_SESSION['PluginProperties'])) { @@ -326,12 +367,12 @@ class ApplicationContext /** * Set plugin properties - * @param sPluginClass string Class implementing any plugin interface - * @param sProperty string Name of the property - * @param value scalar Value (numeric or string) + * @param string $sPluginClass Class implementing any plugin interface + * @param string $sProperty Name of the property + * @param mixed $value Value (numeric or string) * @return void */ - public static function SetPluginProperty($sPluginClass, $sProperty, $value) + static public function SetPluginProperty($sPluginClass, $sProperty, $value) { if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties(); @@ -341,10 +382,10 @@ class ApplicationContext /** * Get plugin properties - * @param sPluginClass string Class implementing any plugin interface + * @param string $sPluginClass Class implementing any plugin interface * @return array of sProperty=>value pairs */ - public static function GetPluginProperties($sPluginClass) + static public function GetPluginProperties($sPluginClass) { if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties(); @@ -359,4 +400,3 @@ class ApplicationContext } } -?>