File indexing completed on 2025-01-19 05:21:37
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 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @license http://framework.zend.com/license/new-bsd New BSD License 0019 * @version $Id$ 0020 */ 0021 0022 /** @see Zend_Tool_Project_Provider_Abstract */ 0023 // require_once 'Zend/Tool/Project/Provider/Abstract.php'; 0024 0025 /** 0026 * @category Zend 0027 * @package Zend_Tool 0028 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0029 * @license http://framework.zend.com/license/new-bsd New BSD License 0030 */ 0031 class Zend_Tool_Project_Provider_ProjectProvider extends Zend_Tool_Project_Provider_Abstract 0032 { 0033 0034 /** 0035 * createResource() 0036 * 0037 * @param Zend_Tool_Project_Profile $profile 0038 * @param string $projectProviderName 0039 * @param string $actionNames 0040 * @return Zend_Tool_Project_Profile_Resource 0041 */ 0042 public static function createResource(Zend_Tool_Project_Profile $profile, $projectProviderName, $actionNames = null) 0043 { 0044 0045 if (!is_string($projectProviderName)) { 0046 /** 0047 * @see Zend_Tool_Project_Provider_Exception 0048 */ 0049 // require_once 'Zend/Tool/Project/Provider/Exception.php'; 0050 throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Controller::createResource() expects \"projectProviderName\" is the name of a project provider resource to create.'); 0051 } 0052 0053 $profileSearchParams = array(); 0054 $profileSearchParams[] = 'projectProvidersDirectory'; 0055 0056 $projectProvider = $profile->createResourceAt($profileSearchParams, 'projectProviderFile', array('projectProviderName' => $projectProviderName, 'actionNames' => $actionNames)); 0057 0058 return $projectProvider; 0059 } 0060 0061 /** 0062 * getName() 0063 * 0064 * @return string 0065 */ 0066 public function getName() 0067 { 0068 return 'ProjectProvider'; 0069 } 0070 0071 /** 0072 * Create stub for Zend_Tool Project Provider 0073 * 0074 * @var string $name class name for new Zend_Tool Project Provider 0075 * @var array|string $actions list of provider methods 0076 * @throws Zend_Tool_Project_Provider_Exception 0077 */ 0078 public function create($name, $actions = null) 0079 { 0080 $profile = $this->_loadProfileRequired(); 0081 0082 $projectProvider = self::createResource($profile, $name, $actions); 0083 0084 if ($this->_registry->getRequest()->isPretend()) { 0085 $this->_registry->getResponse()->appendContent('Would create a project provider named ' . $name 0086 . ' in location ' . $projectProvider->getPath() 0087 ); 0088 } else { 0089 $this->_registry->getResponse()->appendContent('Creating a project provider named ' . $name 0090 . ' in location ' . $projectProvider->getPath() 0091 ); 0092 $projectProvider->create(); 0093 $this->_storeProfile(); 0094 } 0095 0096 } 0097 }