StaticReflectionService.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace Doctrine\Persistence\Mapping;
  3. use function strpos;
  4. use function strrev;
  5. use function strrpos;
  6. use function substr;
  7. /**
  8. * PHP Runtime Reflection Service.
  9. */
  10. class StaticReflectionService implements ReflectionService
  11. {
  12. /**
  13. * {@inheritDoc}
  14. */
  15. public function getParentClasses($class)
  16. {
  17. return [];
  18. }
  19. /**
  20. * {@inheritDoc}
  21. */
  22. public function getClassShortName($className)
  23. {
  24. if (strpos($className, '\\') !== false) {
  25. $className = substr($className, strrpos($className, '\\') + 1);
  26. }
  27. return $className;
  28. }
  29. /**
  30. * {@inheritDoc}
  31. */
  32. public function getClassNamespace($className)
  33. {
  34. $namespace = '';
  35. if (strpos($className, '\\') !== false) {
  36. $namespace = strrev(substr(strrev($className), strpos(strrev($className), '\\') + 1));
  37. }
  38. return $namespace;
  39. }
  40. /**
  41. * {@inheritDoc}
  42. */
  43. public function getClass($class)
  44. {
  45. return null;
  46. }
  47. /**
  48. * {@inheritDoc}
  49. */
  50. public function getAccessibleProperty($class, $property)
  51. {
  52. return null;
  53. }
  54. /**
  55. * {@inheritDoc}
  56. */
  57. public function hasPublicMethod($class, $method)
  58. {
  59. return true;
  60. }
  61. }