1: <?php
2: /**
3: * Horde_Pear_Package_Contents_Role_HordeComponent:: handles file roles for
4: * Horde components.
5: *
6: * PHP version 5
7: *
8: * @category Horde
9: * @package Pear
10: * @author Gunnar Wrobel <wrobel@pardus.de>
11: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
12: * @link http://pear.horde.org/index.php?package=Pear
13: */
14:
15: /**
16: * Horde_Pear_Package_Contents_Role_HordeComponent:: handles file roles for
17: * Horde components.
18: *
19: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
20: *
21: * See the enclosed file COPYING for license information (LGPL). If you
22: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
23: *
24: * @category Horde
25: * @package Pear
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Pear
29: */
30: class Horde_Pear_Package_Contents_Role_HordeComponent
31: implements Horde_Pear_Package_Contents_Role
32: {
33: /**
34: * Tell which role the specified file has.
35: *
36: * @param string $file The file name.
37: *
38: * @return string The role of the file.
39: */
40: public function getRole($file)
41: {
42: $elements = explode('/', substr($file, 1));
43: $basedir = array_shift($elements);
44: switch ($basedir) {
45: case 'bin':
46: return 'script';
47: case 'COPYING':
48: case 'doc':
49: case 'examples':
50: return 'doc';
51: case 'data':
52: case 'locale':
53: case 'migration':
54: return 'data';
55: case 'js':
56: return 'horde';
57: case 'test':
58: return 'test';
59: default:
60: return 'php';
61: }
62: }
63: }