For the purpose of showing off PDT's features, I have created a small sample project, consisting of four files:
1.
config/settings.xml:
Application configuration settings in XML format.2.
classes/Configurable.php:
An interface stipulating methodssetup()
andgetSetting()
. By defining this interface, we leave the details such as the source of the configuration data or the internal data structure to the implementing class.3.
classes/Config/Xml.php:
A class implementing interface Configurable and providing implementations of methodssetup()
to parse the above XML file andgetSetting()
to allow the application to retrieve a stored configuration setting. This class was implemented as a singleton with the assumptions that configuration settings don't and shouldn't be read more than once during the execution of the application.4.
index.php:
The main executable that requires the other source files, instantiates aConfig_Xml
object, and outputs one of the settings just to show...