summaryrefslogtreecommitdiff
path: root/framework/Configuration/Provider/TProviderBase.php
blob: 2d44bf39555ee16c6dd6c40678eb7fb3c0fca4a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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']);
		}
	}
}
?>