2
0

Abstract.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 $_isStatic = false;
  49. /**
  50. * @var const
  51. */
  52. protected $_visibility = self::VISIBILITY_PUBLIC;
  53. /**
  54. * @var string
  55. */
  56. protected $_name = null;
  57. /**
  58. * setDocblock() Set the docblock
  59. *
  60. * @param Zend_CodeGenerator_Php_Docblock|array|string $docblock
  61. * @return Zend_CodeGenerator_Php_File
  62. */
  63. public function setDocblock($docblock)
  64. {
  65. if (is_string($docblock)) {
  66. $docblock = array('shortDescription' => $docblock);
  67. }
  68. if (is_array($docblock)) {
  69. $docblock = new Zend_CodeGenerator_Php_Docblock($docblock);
  70. } elseif (!$docblock instanceof Zend_CodeGenerator_Php_Docblock) {
  71. require_once 'Zend/CodeGenerator/Php/Exception.php';
  72. throw new Zend_CodeGenerator_Php_Exception('setDocblock() is expecting either a string, array or an instance of Zend_CodeGenerator_Php_Docblock');
  73. }
  74. $this->_docblock = $docblock;
  75. return $this;
  76. }
  77. /**
  78. * getDocblock()
  79. *
  80. * @return Zend_CodeGenerator_Php_Docblock
  81. */
  82. public function getDocblock()
  83. {
  84. return $this->_docblock;
  85. }
  86. /**
  87. * setAbstract()
  88. *
  89. * @param bool $isAbstract
  90. * @return Zend_CodeGenerator_Php_Member_Abstract
  91. */
  92. public function setAbstract($isAbstract)
  93. {
  94. $this->_isAbstract = ($isAbstract) ? true : false;
  95. return $this;
  96. }
  97. /**
  98. * isAbstract()
  99. *
  100. * @return bool
  101. */
  102. public function isAbstract()
  103. {
  104. return $this->_isAbstract;
  105. }
  106. /**
  107. * setStatic()
  108. *
  109. * @param bool $isStatic
  110. * @return Zend_CodeGenerator_Php_Member_Abstract
  111. */
  112. public function setStatic($isStatic)
  113. {
  114. $this->_isStatic = ($isStatic) ? true : false;
  115. return $this;
  116. }
  117. /**
  118. * isStatic()
  119. *
  120. * @return bool
  121. */
  122. public function isStatic()
  123. {
  124. return $this->_isStatic;
  125. }
  126. /**
  127. * setVisitibility()
  128. *
  129. * @param const $visibility
  130. * @return Zend_CodeGenerator_Php_Member_Abstract
  131. */
  132. public function setVisibility($visibility)
  133. {
  134. $this->_visibility = $visibility;
  135. return $this;
  136. }
  137. /**
  138. * getVisibility()
  139. *
  140. * @return const
  141. */
  142. public function getVisibility()
  143. {
  144. return $this->_visibility;
  145. }
  146. /**
  147. * setName()
  148. *
  149. * @param string $name
  150. * @return Zend_CodeGenerator_Php_Member_Abstract
  151. */
  152. public function setName($name)
  153. {
  154. $this->_name = $name;
  155. return $this;
  156. }
  157. /**
  158. * getName()
  159. *
  160. * @return string
  161. */
  162. public function getName()
  163. {
  164. return $this->_name;
  165. }
  166. }