root/trunk/src/main/php/net/stubbles/util/xjconf/stubXJConfLoader.php

Revision 1536, 1.7 kB (checked in by mikey, 1 month ago)

removed support for dots as package separator

Line 
1 <?php
2 /**
3  * Class loader to use for XJConf.
4  *
5  * @author      Frank Kleine <mikey@stubbles.net>
6  * @author      Stephan Schmidt <schst@stubbles.net>
7  * @package     stubbles
8  * @subpackage  util_xjconf
9  */
10 stubClassLoader::load('net::xjconf::XJConfClassLoader');
11 /**
12  * Class loader to use for XJConf.
13  *
14  * Maps the stubClassLoader.
15  *
16  * @package     stubbles
17  * @subpackage  util_xjconf
18  * @uses        http://php.xjconf.net/
19  */
20 class stubXJConfLoader extends stubBaseObject implements XJConfClassLoader
21 {
22     /**
23      * instance of the class loader
24      *
25      * @var  stubClassLoader
26      */
27     private static $instance;
28
29     /**
30      * forbidden constructor (singleton)
31      */
32     private final function __construct()
33     {
34         // nothing to do
35     }
36
37     /**
38      * returns an instance of the class loader
39      *
40      * @return  stubClassLoader
41      */
42     public static function getInstance()
43     {
44         if (null == self::$instance) {
45             self::$instance = new self();
46         }
47
48         return self::$instance;
49     }
50
51     /**
52      * forbidden cloning (singleton)
53      */
54     private final function __clone()
55     {
56         // nothing to do
57     }
58
59     /**
60      * load the file with the given class
61      *
62      * @param  string  $fqClassName  the full qualified class name
63      */
64     public function loadClass($fqClassName)
65     {
66         stubClassLoader::load($fqClassName);
67     }
68
69     /**
70      * returns short class name
71      *
72      * @param   string  $fqClassName  the full qualified class name
73      * @return  string
74      */
75     public function getType($fqClassName)
76     {
77         $className = explode('::', $fqClassName);
78         return $className[count($className) - 1];
79     }
80 }
81 ?>
Note: See TracBrowser for help on using the browser.