From a90da4361d02a53204f198f19072e2d420b394f0 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 3 Sep 2006 21:33:04 +0000 Subject: Added TEnumerable and updated places where enumerable type should be used. --- framework/TApplication.php | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'framework/TApplication.php') diff --git a/framework/TApplication.php b/framework/TApplication.php index 375df885..0cce1a1a 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -112,7 +112,8 @@ require_once(PRADO_DIR.'/I18N/TGlobalization.php'); class TApplication extends TComponent { /** - * application state + * possible application mode. + * @deprecated deprecated since version 3.0.4 (use TApplicationMode constants instead) */ const STATE_OFF='Off'; const STATE_DEBUG='Debug'; @@ -260,9 +261,9 @@ class TApplication extends TComponent */ private $_authRules=null; /** - * @var string application mode + * @var TApplicationMode application mode */ - private $_mode='Debug'; + private $_mode=TApplicationMode::Debug; /** * Constructor. @@ -465,7 +466,7 @@ class TApplication extends TComponent } /** - * @return string application mode (Off|Debug|Normal|Peformance), defaults to Debug. + * @return TApplicationMode application mode. Defaults to TApplicationMode::Debug. */ public function getMode() { @@ -473,11 +474,11 @@ class TApplication extends TComponent } /** - * @param string application mode. Valid values include Off, Debug, Normal, or Peformance + * @param TApplicationMode application mode */ public function setMode($value) { - $this->_mode=TPropertyValue::ensureEnum($value,array(self::STATE_OFF,self::STATE_DEBUG,self::STATE_NORMAL,self::STATE_PERFORMANCE)); + $this->_mode=TPropertyValue::ensureEnumerable($value,'TApplicationMode'); } /** @@ -1037,6 +1038,28 @@ class TApplication extends TComponent } } +/** + * TApplicationMode class. + * TApplicationMode defines the possible mode that an application can be set at by + * setting {@link TApplication::setMode Mode}. + * In particular, the following modes are defined + * - Off: the application is not running. Any request to the application will obtain an error. + * - Debug: the application is running in debug mode. + * - Debug: the application is running in normal production mode. + * - Performance: the application is running in performance mode. + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System + * @since 3.0.4 + */ +class TApplicationMode extends TEnumerable +{ + const Off='Off'; + const Debug='Debug'; + const Normal='Normal'; + const Performance='Performance'; +} + /** * TApplicationConfiguration class. -- cgit v1.2.3