File indexing completed on 2025-01-19 05:21:36
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_TopLevelRestrictable 0035 */ 0036 // require_once 'Zend/Tool/Project/Context/System/TopLevelRestrictable.php'; 0037 0038 /** 0039 * @see Zend_Tool_Project_Context_System_NotOverwritable 0040 */ 0041 // require_once 'Zend/Tool/Project/Context/System/NotOverwritable.php'; 0042 0043 /** 0044 * This class is the front most class for utilizing Zend_Tool_Project 0045 * 0046 * A profile is a hierarchical set of resources that keep track of 0047 * items within a specific project. 0048 * 0049 * @category Zend 0050 * @package Zend_Tool 0051 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0052 * @license http://framework.zend.com/license/new-bsd New BSD License 0053 */ 0054 class Zend_Tool_Project_Context_System_ProjectDirectory 0055 extends Zend_Tool_Project_Context_Filesystem_Directory 0056 implements Zend_Tool_Project_Context_System_Interface, 0057 Zend_Tool_Project_Context_System_NotOverwritable, 0058 Zend_Tool_Project_Context_System_TopLevelRestrictable 0059 { 0060 0061 /** 0062 * @var string 0063 */ 0064 protected $_filesystemName = null; 0065 0066 /** 0067 * getName() 0068 * 0069 * @return string 0070 */ 0071 public function getName() 0072 { 0073 return 'ProjectDirectory'; 0074 } 0075 0076 /** 0077 * init() 0078 * 0079 * @return Zend_Tool_Project_Context_System_ProjectDirectory 0080 */ 0081 public function init() 0082 { 0083 // get base path from attributes (would be in path attribute) 0084 $projectDirectory = $this->_resource->getAttribute('path'); 0085 0086 // if not, get from profile 0087 if ($projectDirectory == null) { 0088 $projectDirectory = $this->_resource->getProfile()->getAttribute('projectDirectory'); 0089 } 0090 0091 // if not, exception. 0092 if ($projectDirectory == null) { 0093 // require_once 'Zend/Tool/Project/Exception.php'; 0094 throw new Zend_Tool_Project_Exception('projectDirectory cannot find the directory for this project.'); 0095 } 0096 0097 $this->_baseDirectory = rtrim($projectDirectory, '\\/'); 0098 return $this; 0099 } 0100 0101 /** 0102 * create() 0103 * 0104 * @return Zend_Tool_Project_Context_System_ProjectDirectory 0105 */ 0106 public function create() 0107 { 0108 if (file_exists($this->getPath())) { 0109 /* 0110 foreach (new DirectoryIterator($this->getPath()) as $item) { 0111 if (!$item->isDot()) { 0112 if ($registry->getClient()->isInteractive()) { 0113 // @todo prompt for override 0114 } else { 0115 // require_once 'Zend/Tool/Project/Context/Exception.php'; 0116 throw new Zend_Tool_Project_Context_Exception('This directory is not empty, project creation aborted.'); 0117 } 0118 break; 0119 } 0120 } 0121 */ 0122 } 0123 0124 parent::create(); 0125 return $this; 0126 } 0127 0128 }