IControllerMethodReflector.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP\AppFramework\Utility;
  27. /**
  28. * Interface ControllerMethodReflector
  29. *
  30. * Reads and parses annotations from doc comments
  31. *
  32. * @package OCP\AppFramework\Utility
  33. * @since 8.0.0
  34. */
  35. interface IControllerMethodReflector {
  36. /**
  37. * @param object $object an object or classname
  38. * @param string $method the method which we want to inspect
  39. * @return void
  40. * @since 8.0.0
  41. * @deprecated 17.0.0 Reflect should not be called multiple times and only be used internally. This will be removed in Nextcloud 18
  42. */
  43. public function reflect($object, string $method);
  44. /**
  45. * Inspects the PHPDoc parameters for types
  46. *
  47. * @param string $parameter the parameter whose type comments should be
  48. * parsed
  49. * @return string|null type in the type parameters (@param int $something)
  50. * would return int or null if not existing
  51. * @since 8.0.0
  52. */
  53. public function getType(string $parameter);
  54. /**
  55. * @return array the arguments of the method with key => default value
  56. * @since 8.0.0
  57. */
  58. public function getParameters(): array;
  59. /**
  60. * Check if a method contains an annotation
  61. *
  62. * @param string $name the name of the annotation
  63. * @return bool true if the annotation is found
  64. * @since 8.0.0
  65. */
  66. public function hasAnnotation(string $name): bool;
  67. }