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_Zf_AbstractClassFile 0025 */ 0026 // require_once 'Zend/Tool/Project/Context/Zf/AbstractClassFile.php'; 0027 0028 /** 0029 * This class is the front most class for utilizing Zend_Tool_Project 0030 * 0031 * A profile is a hierarchical set of resources that keep track of 0032 * items within a specific project. 0033 * 0034 * @category Zend 0035 * @package Zend_Tool 0036 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0037 * @license http://framework.zend.com/license/new-bsd New BSD License 0038 */ 0039 class Zend_Tool_Project_Context_Zf_FormFile extends Zend_Tool_Project_Context_Zf_AbstractClassFile 0040 { 0041 0042 /** 0043 * @var string 0044 */ 0045 protected $_formName = 'Base'; 0046 0047 /** 0048 * @var string 0049 */ 0050 protected $_filesystemName = 'formName'; 0051 0052 /** 0053 * init() 0054 * 0055 */ 0056 public function init() 0057 { 0058 $this->_formName = $this->_resource->getAttribute('formName'); 0059 $this->_filesystemName = ucfirst($this->_formName) . '.php'; 0060 parent::init(); 0061 } 0062 0063 /** 0064 * getPersistentAttributes 0065 * 0066 * @return array 0067 */ 0068 public function getPersistentAttributes() 0069 { 0070 return array( 0071 'formName' => $this->getFormName() 0072 ); 0073 } 0074 0075 /** 0076 * getName() 0077 * 0078 * @return string 0079 */ 0080 public function getName() 0081 { 0082 return 'FormFile'; 0083 } 0084 0085 public function getFormName() 0086 { 0087 return $this->_formName; 0088 } 0089 0090 public function getContents() 0091 { 0092 0093 $className = $this->getFullClassName($this->_formName, 'Form'); 0094 0095 $codeGenFile = new Zend_CodeGenerator_Php_File(array( 0096 'fileName' => $this->getPath(), 0097 'classes' => array( 0098 new Zend_CodeGenerator_Php_Class(array( 0099 'name' => $className, 0100 'extendedClass' => 'Zend_Form', 0101 'methods' => array( 0102 new Zend_CodeGenerator_Php_Method(array( 0103 'name' => 'init', 0104 'body' => '/* Form Elements & Other Definitions Here ... */', 0105 )) 0106 ) 0107 0108 )) 0109 ) 0110 )); 0111 return $codeGenFile->generate(); 0112 } 0113 }