1 | <?php |
||
27 | class Loader |
||
28 | { |
||
29 | private $fileExtension = '.php'; |
||
30 | private $namespace; |
||
31 | private $includePath; |
||
32 | private $namespaceSeparator = '\\'; |
||
33 | |||
34 | /** |
||
35 | * Creates a new <tt>Loader</tt> that loads classes of the |
||
36 | * specified namespace. |
||
37 | * |
||
38 | * @param string $namespace The namespace to use. |
||
39 | * @param null $includePath |
||
40 | */ |
||
41 | public function __construct($namespace = 'VirtualFileSystem', $includePath = null) |
||
46 | |||
47 | /** |
||
48 | * Sets the namespace separator used by classes in the namespace of this class loader. |
||
49 | * |
||
50 | * @param string $sep The separator to use. |
||
51 | */ |
||
52 | public function setNamespaceSeparator($sep) |
||
56 | |||
57 | /** |
||
58 | * Gets the namespace seperator used by classes in the namespace of this class loader. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getNamespaceSeparator() |
||
66 | |||
67 | /** |
||
68 | * Sets the base include path for all class files in the namespace of this class loader. |
||
69 | * |
||
70 | * @param string $includePath |
||
71 | */ |
||
72 | public function setIncludePath($includePath) |
||
76 | |||
77 | /** |
||
78 | * Gets the base include path for all class files in the namespace of this class loader. |
||
79 | * |
||
80 | * @return null|string $includePath |
||
81 | */ |
||
82 | public function getIncludePath() |
||
86 | |||
87 | /** |
||
88 | * Sets the file extension of class files in the namespace of this class loader. |
||
89 | * |
||
90 | * @param string $fileExtension |
||
91 | */ |
||
92 | public function setFileExtension($fileExtension) |
||
96 | |||
97 | /** |
||
98 | * Gets the file extension of class files in the namespace of this class loader. |
||
99 | * |
||
100 | * @return string $fileExtension |
||
101 | */ |
||
102 | public function getFileExtension() |
||
106 | |||
107 | /** |
||
108 | * Installs this class loader on the SPL autoload stack. |
||
109 | * |
||
110 | * @param bool $prepend If true, prepend autoloader on the autoload stack |
||
111 | */ |
||
112 | public function register($prepend = false) |
||
116 | |||
117 | /** |
||
118 | * Uninstalls this class loader from the SPL autoloader stack. |
||
119 | */ |
||
120 | public function unregister() |
||
124 | |||
125 | /** |
||
126 | * Loads the given class or interface. |
||
127 | * |
||
128 | * @param string $className The name of the class to load. |
||
129 | * @return void |
||
130 | */ |
||
131 | public function loadClass($className) |
||
151 | } |
||
152 |