StaticReflectionProperty.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. *
  15. * This software consists of voluntary contributions made by many individuals
  16. * and is licensed under the MIT license. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\Common\Reflection;
  20. use ReflectionProperty;
  21. use ReflectionException;
  22. class StaticReflectionProperty extends ReflectionProperty
  23. {
  24. /**
  25. * The PSR-0 parser object.
  26. *
  27. * @var StaticReflectionParser
  28. */
  29. protected $staticReflectionParser;
  30. /**
  31. * The name of the property.
  32. *
  33. * @var string|null
  34. */
  35. protected $propertyName;
  36. /**
  37. * @param StaticReflectionParser $staticReflectionParser
  38. * @param string|null $propertyName
  39. */
  40. public function __construct(StaticReflectionParser $staticReflectionParser, $propertyName)
  41. {
  42. $this->staticReflectionParser = $staticReflectionParser;
  43. $this->propertyName = $propertyName;
  44. }
  45. /**
  46. * {@inheritDoc}
  47. */
  48. public function getName()
  49. {
  50. return $this->propertyName;
  51. }
  52. /**
  53. * @return StaticReflectionParser
  54. */
  55. protected function getStaticReflectionParser()
  56. {
  57. return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', $this->propertyName);
  58. }
  59. /**
  60. * {@inheritDoc}
  61. */
  62. public function getDeclaringClass()
  63. {
  64. return $this->getStaticReflectionParser()->getReflectionClass();
  65. }
  66. /**
  67. * {@inheritDoc}
  68. */
  69. public function getDocComment()
  70. {
  71. return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName);
  72. }
  73. /**
  74. * @return array
  75. */
  76. public function getUseStatements()
  77. {
  78. return $this->getStaticReflectionParser()->getUseStatements();
  79. }
  80. /**
  81. * {@inheritDoc}
  82. */
  83. public static function export ($class, $name, $return = false)
  84. {
  85. throw new ReflectionException('Method not implemented');
  86. }
  87. /**
  88. * {@inheritDoc}
  89. */
  90. public function getModifiers()
  91. {
  92. throw new ReflectionException('Method not implemented');
  93. }
  94. /**
  95. * {@inheritDoc}
  96. */
  97. public function getValue($object = null)
  98. {
  99. throw new ReflectionException('Method not implemented');
  100. }
  101. /**
  102. * {@inheritDoc}
  103. */
  104. public function isDefault()
  105. {
  106. throw new ReflectionException('Method not implemented');
  107. }
  108. /**
  109. * {@inheritDoc}
  110. */
  111. public function isPrivate()
  112. {
  113. throw new ReflectionException('Method not implemented');
  114. }
  115. /**
  116. * {@inheritDoc}
  117. */
  118. public function isProtected()
  119. {
  120. throw new ReflectionException('Method not implemented');
  121. }
  122. /**
  123. * {@inheritDoc}
  124. */
  125. public function isPublic()
  126. {
  127. throw new ReflectionException('Method not implemented');
  128. }
  129. /**
  130. * {@inheritDoc}
  131. */
  132. public function isStatic()
  133. {
  134. throw new ReflectionException('Method not implemented');
  135. }
  136. /**
  137. * {@inheritDoc}
  138. */
  139. public function setAccessible ($accessible)
  140. {
  141. throw new ReflectionException('Method not implemented');
  142. }
  143. /**
  144. * {@inheritDoc}
  145. */
  146. public function setValue ($object, $value = null)
  147. {
  148. throw new ReflectionException('Method not implemented');
  149. }
  150. /**
  151. * {@inheritDoc}
  152. */
  153. public function __toString()
  154. {
  155. throw new ReflectionException('Method not implemented');
  156. }
  157. }