IControllerMethodReflector.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Olivier Paroz <github@oparoz.com>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\AppFramework\Utility;
  26. /**
  27. * Interface ControllerMethodReflector
  28. *
  29. * Reads and parses annotations from doc comments
  30. *
  31. * @package OCP\AppFramework\Utility
  32. * @since 8.0.0
  33. */
  34. interface IControllerMethodReflector {
  35. /**
  36. * @param object $object an object or classname
  37. * @param string $method the method which we want to inspect
  38. * @return void
  39. * @since 8.0.0
  40. */
  41. public function reflect($object, string $method);
  42. /**
  43. * Inspects the PHPDoc parameters for types
  44. *
  45. * @param string $parameter the parameter whose type comments should be
  46. * parsed
  47. * @return string|null type in the type parameters (@param int $something)
  48. * would return int or null if not existing
  49. * @since 8.0.0
  50. */
  51. public function getType(string $parameter);
  52. /**
  53. * @return array the arguments of the method with key => default value
  54. * @since 8.0.0
  55. */
  56. public function getParameters(): array;
  57. /**
  58. * Check if a method contains an annotation
  59. *
  60. * @param string $name the name of the annotation
  61. * @return bool true if the annotation is found
  62. * @since 8.0.0
  63. */
  64. public function hasAnnotation(string $name): bool;
  65. }