2
0

Abstract.php 4.7 KB

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