diff options
Diffstat (limited to 'framework/Configuration')
| -rw-r--r-- | framework/Configuration/Provider/TProviderBase.php | 54 | ||||
| -rw-r--r-- | framework/Configuration/Provider/TProviderException.php | 19 | 
2 files changed, 73 insertions, 0 deletions
diff --git a/framework/Configuration/Provider/TProviderBase.php b/framework/Configuration/Provider/TProviderBase.php new file mode 100644 index 00000000..2d44bf39 --- /dev/null +++ b/framework/Configuration/Provider/TProviderBase.php @@ -0,0 +1,54 @@ +<?php +/** + * TProviderBase class. + * Provides a base implementation for the extensible provider model. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TProviderBase.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ +abstract class TProviderBase +{ +	private $_Description; +	private $_Initialized = false; +	private $_name; + +	public function __construct(){} + +	public function getDescription() +	{ +		return $this->_Description; +	} +	public function getName() +	{ +		return $this->_name; +	} +	public function Initialize($name,$config) +	{ +		if ($this->_Initialized) +		{ +			throw new TProviderException('Provider_Already_Initialized'); +		} +		$this->_Initialized=true; + +		if ($name === null) +		{ +			throw new TProviderException('name'); +		} + +		if (strlen($name) == 0) +		{ +			throw new TProviderException('Config_provider_name_null_or_empty'); +		} + +		$this->_name = TPropertyValue::ensureString($name); + +		if ($config !== null && is_array($config)) +		{ +			$this->_Description = TPropertyValue::ensureString($config['description']); +			unset($config['description']); +		} +	} +} +?>
\ No newline at end of file diff --git a/framework/Configuration/Provider/TProviderException.php b/framework/Configuration/Provider/TProviderException.php new file mode 100644 index 00000000..ac2caf08 --- /dev/null +++ b/framework/Configuration/Provider/TProviderException.php @@ -0,0 +1,19 @@ +<?php +/** + * TProviderException class. + * The exception that is thrown when a configuration provider error has occurred.  + * This exception class is also used by providers to throw exceptions when internal  + * errors occur within the provider that do not map to other pre-existing exception classes. + * + * @author Jason Ragsdale <jrags@jasrags.net> + * @version $Id: TProviderException.php 1398 2006-09-08 19:31:03Z xue $ + * @package System.Configuration.Provider + * @since 3.1 + */ + +Prado::using('System.Exceptions.TException'); +class TProviderException extends TException  +{ +	 +} +?>
\ No newline at end of file  | 
