File indexing completed on 2024-11-10 05:22:04
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Tool 0017 * @subpackage Framework 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** 0024 * @see Zend_Tool_Project_Context_Filesystem_Directory 0025 */ 0026 // require_once 'Zend/Tool/Project/Context/Filesystem/Directory.php'; 0027 0028 /** 0029 * @see Zend_Tool_Project_Context_System_Interface 0030 */ 0031 // require_once 'Zend/Tool/Project/Context/System/Interface.php'; 0032 0033 /** 0034 * @see Zend_Tool_Project_Context_System_NotOverwritable 0035 */ 0036 // require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php'; 0037 0038 /** 0039 * This class is the front most class for utilizing Zend_Tool_Project 0040 * 0041 * A profile is a hierarchical set of resources that keep track of 0042 * items within a specific project. 0043 * 0044 * @category Zend 0045 * @package Zend_Tool 0046 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0047 * @license http://framework.zend.com/license/new-bsd New BSD License 0048 */ 0049 class Zend_Tool_Project_Context_System_ProjectProvidersDirectory 0050 extends Zend_Tool_Project_Context_Filesystem_Directory 0051 implements Zend_Tool_Project_Context_System_Interface, 0052 Zend_Tool_Project_Context_System_NotOverwritable 0053 { 0054 0055 /** 0056 * @var string 0057 */ 0058 protected $_filesystemName = 'providers'; 0059 0060 /** 0061 * getName() 0062 * 0063 * @return string 0064 */ 0065 public function getName() 0066 { 0067 return 'ProjectProvidersDirectory'; 0068 } 0069 0070 public function loadProviders(Zend_Tool_Framework_Registry_Interface $registry) 0071 { 0072 if (file_exists($this->getPath())) { 0073 0074 $providerRepository = $registry->getProviderRepository(); 0075 0076 foreach (new DirectoryIterator($this->getPath()) as $item) { 0077 if ($item->isFile() && (($suffixStart = strpos($item->getFilename(), 'Provider.php')) !== false)) { 0078 $className = substr($item->getFilename(), 0, $suffixStart+8); 0079 // $loadableFiles[$className] = $item->getPathname(); 0080 include_once $item- >getPathname(); 0081 $providerRepository->addProvider(new $className()); 0082 } 0083 } 0084 } 0085 } 0086 0087 }