Abstract.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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_CodeGenerator
  17. * @subpackage PHP
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_CodeGenerator_Php_Abstract
  24. */
  25. require_once 'Zend/CodeGenerator/Php/Abstract.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_CodeGenerator
  29. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. abstract class Zend_CodeGenerator_Php_Member_Abstract extends Zend_CodeGenerator_Php_Abstract
  33. {
  34. /**#@+
  35. * @param const string
  36. */
  37. const VISIBILITY_PUBLIC = 'public';
  38. const VISIBILITY_PROTECTED = 'protected';
  39. const VISIBILITY_PRIVATE = 'private';
  40. /**#@-*/
  41. /**
  42. * @var bool
  43. */
  44. protected $_isAbstract = false;
  45. /**
  46. * @var bool
  47. */
  48. protected $_isFinal = false;
  49. /**
  50. * @var bool
  51. */
  52. protected $_isStatic = false;
  53. /**
  54. * @var const
  55. */
  56. protected $_visibility = self::VISIBILITY_PUBLIC;
  57. /**
  58. * @var string
  59. */
  60. protected $_name = null;
  61. /**
  62. * setDocblock() Set the docblock
  63. *
  64. * @param Zend_CodeGenerator_Php_Docblock|array|string $docblock
  65. * @return Zend_CodeGenerator_Php_File
  66. */
  67. public function setDocblock($docblock)
  68. {
  69. if (is_string($docblock)) {
  70. $docblock = array('shortDescription' => $docblock);
  71. }
  72. if (is_array($docblock)) {
  73. $docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
  74. } elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
  75. require_once 'Zend/CodeGenerator/Php/Exception.php';
  76. throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
  77. }
  78. $this->_docblock = $docblock;
  79. return $this;
  80. }
  81. /**
  82. * getDocblock()
  83. *
  84. * @return Zend_CodeGenerator_Php_Docblock
  85. */
  86. public function getDocblock()
  87. {
  88. return $this->_docblock;
  89. }
  90. /**
  91. * setAbstract()
  92. *
  93. * @param bool $isAbstract
  94. * @return Zend_CodeGenerator_Php_Member_Abstract
  95. */
  96. public function setAbstract($isAbstract)
  97. {
  98. $this->_isAbstract = ($isAbstract) ? true : false;
  99. return $this;
  100. }
  101. /**
  102. * isAbstract()
  103. *
  104. * @return bool
  105. */
  106. public function isAbstract()
  107. {
  108. return $this->_isAbstract;
  109. }
  110. /**
  111. * setFinal()
  112. *
  113. * @param bool $isFinal
  114. * @return Zend_CodeGenerator_Php_Member_Abstract
  115. */
  116. public function setFinal($isFinal)
  117. {
  118. $this->_isFinal = ($isFinal) ? true : false;
  119. return $this;
  120. }
  121. /**
  122. * isFinal()
  123. *
  124. * @return bool
  125. */
  126. public function isFinal()
  127. {
  128. return $this->_isFinal;
  129. }
  130. /**
  131. * setStatic()
  132. *
  133. * @param bool $isStatic
  134. * @return Zend_CodeGenerator_Php_Member_Abstract
  135. */
  136. public function setStatic($isStatic)
  137. {
  138. $this->_isStatic = ($isStatic) ? true : false;
  139. return $this;
  140. }
  141. /**
  142. * isStatic()
  143. *
  144. * @return bool
  145. */
  146. public function isStatic()
  147. {
  148. return $this->_isStatic;
  149. }
  150. /**
  151. * setVisitibility()
  152. *
  153. * @param const $visibility
  154. * @return Zend_CodeGenerator_Php_Member_Abstract
  155. */
  156. public function setVisibility($visibility)
  157. {
  158. $this->_visibility = $visibility;
  159. return $this;
  160. }
  161. /**
  162. * getVisibility()
  163. *
  164. * @return const
  165. */
  166. public function getVisibility()
  167. {
  168. return $this->_visibility;
  169. }
  170. /**
  171. * setName()
  172. *
  173. * @param string $name
  174. * @return Zend_CodeGenerator_Php_Member_Abstract
  175. */
  176. public function setName($name)
  177. {
  178. $this->_name = $name;
  179. return $this;
  180. }
  181. /**
  182. * getName()
  183. *
  184. * @return string
  185. */
  186. public function getName()
  187. {
  188. return $this->_name;
  189. }
  190. }