|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Tool |
|
17 * @subpackage Framework |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: ProjectProvidersDirectory.php 23202 2010-10-21 15:08:15Z ralph $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Tool_Project_Context_Filesystem_Directory |
|
25 */ |
|
26 require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Tool_Project_Context_System_Interface |
|
30 */ |
|
31 require_once 'Zend/Tool/Project/Context/System/Interface.php'; |
|
32 |
|
33 /** |
|
34 * @see Zend_Tool_Project_Context_System_NotOverwritable |
|
35 */ |
|
36 require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php'; |
|
37 |
|
38 /** |
|
39 * This class is the front most class for utilizing Zend_Tool_Project |
|
40 * |
|
41 * A profile is a hierarchical set of resources that keep track of |
|
42 * items within a specific project. |
|
43 * |
|
44 * @category Zend |
|
45 * @package Zend_Tool |
|
46 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
47 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
48 */ |
|
49 class Zend_Tool_Project_Context_System_ProjectProvidersDirectory |
|
50 extends Zend_Tool_Project_Context_Filesystem_Directory |
|
51 implements Zend_Tool_Project_Context_System_Interface, |
|
52 Zend_Tool_Project_Context_System_NotOverwritable |
|
53 { |
|
54 |
|
55 /** |
|
56 * @var string |
|
57 */ |
|
58 protected $_filesystemName = 'providers'; |
|
59 |
|
60 /** |
|
61 * getName() |
|
62 * |
|
63 * @return string |
|
64 */ |
|
65 public function getName() |
|
66 { |
|
67 return 'ProjectProvidersDirectory'; |
|
68 } |
|
69 |
|
70 public function loadProviders(Zend_Tool_Framework_Registry_Interface $registry) |
|
71 { |
|
72 if (file_exists($this->getPath())) { |
|
73 |
|
74 $providerRepository = $registry->getProviderRepository(); |
|
75 |
|
76 foreach (new DirectoryIterator($this->getPath()) as $item) { |
|
77 if ($item->isFile() && (($suffixStart = strpos($item->getFilename(), 'Provider.php')) !== false)) { |
|
78 $className = substr($item->getFilename(), 0, $suffixStart+8); |
|
79 // $loadableFiles[$className] = $item->getPathname(); |
|
80 include_once $item->getPathname(); |
|
81 $providerRepository->addProvider(new $className()); |
|
82 } |
|
83 } |
|
84 } |
|
85 } |
|
86 |
|
87 } |