1: <?php
2: /**
3: * VFS API for abstracted file storage and access.
4: *
5: * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (LGPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
9: *
10: * @author Chuck Hagenbuch <chuck@horde.org>
11: * @package Vfs
12: */
13: class Horde_Vfs
14: {
15: /* Quota constants. */
16: const QUOTA_METRIC_BYTE = 1;
17: const QUOTA_METRIC_KB = 2;
18: const QUOTA_METRIC_MB = 3;
19: const QUOTA_METRIC_GB = 4;
20:
21: /**
22: * Attempts to return a concrete instance based on $driver.
23: *
24: * @deprecated
25: *
26: * @param mixed $driver The type of concrete subclass to return. This
27: * is based on the storage driver ($driver). The
28: * code is dynamically included.
29: * @param array $params A hash containing any additional configuration or
30: * connection parameters a subclass might need.
31: *
32: * @return VFS The newly created concrete VFS instance.
33: * @throws Horde_Vfs_Exception
34: */
35: static public function factory($driver, $params = array())
36: {
37: $class = 'Horde_Vfs_' . basename(Horde_String::ucfirst($driver));
38:
39: if (class_exists($class)) {
40: return new $class($params);
41: }
42:
43: throw new Horde_Vfs_Exception('Class definition of ' . $class . ' not found.');
44: }
45: }
46: