1: <?php
2: /**
3: * Luxor_Files:: defines an API to access source file repositories.
4: *
5: * @author Jan Schneider <jan@horde.org>
6: * @since Luxor 0.1
7: * @package Luxor
8: */
9: class Luxor_Files
10: {
11: /**
12: * Attempts to return a concrete Luxor_Files instance based on $driver.
13: *
14: * @param string $driver The type of concrete Luxor_Files subclass
15: * to return. The is based on the repository
16: * driver ($driver). The code is dynamically
17: * included.
18: * @param array $params (optional) A hash containing any additional
19: * configuration or connection parameters a
20: * subclass might need.
21: *
22: * @return mixed The newly created concrete Luxor_Files instance, or
23: * false on an error.
24: */
25: function factory($driver, $params = array())
26: {
27: $driver = basename($driver);
28: $class = 'Luxor_Files_' . $driver;
29: if (class_exists($class)) {
30: return new $class($params);
31: } else {
32: return false;
33: }
34: }
35: }
36: