root/tags/RELEASE_0_2_0/examples/TestInterfaces.php

Revision 41, 1.1 kB (checked in by mikey, 2 years ago)

converted the TestInterfaces? example

Line 
1 <?php
2 /**
3  * Example that shows how to use same classes with differant tags.
4  *
5  * @author  Stephan Schmidt <stephan.schmidt@schlund.de>
6  * @author  Frank Kleine <frank.kleine@schlund.de>
7  */
8 require_once '../XJConf/XJConfLoader.php';
9 XJConfLoader::load('DefinitionParser',
10                    'XmlParser',
11                    'ext.Extension'
12 );
13 require 'MyClass.php';
14 /**
15  * Example that shows how to use same classes with differant tags.
16  *
17  * @package     XJConf
18  * @subpackage  examples
19  */
20 class TestInterfaces
21 {
22     public static function main()
23     {
24         $tagParser = new DefinitionParser();
25         $defs      = $tagParser->parse(getcwd() . '/xml/defines-interfaces.xml');
26
27         $conf      = new XmlParser();
28         $conf->setTagDefinitions($defs);
29
30         try {
31             $conf->parse(getcwd() . '/xml/test-interfaces.xml');
32         } catch (Exception $e) {
33             echo $e->getMessage();
34             var_dump($e->getTrace());
35             exit(0);
36         }
37         
38         $foo = $conf->getConfigValue('foo');
39         var_dump($foo);
40         var_dump($foo->getBar());
41     }
42 }
43 TestInterfaces::main();
44 ?>
Note: See TracBrowser for help on using the browser.