iroute.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  7. *
  8. * @copyright Copyright (c) 2015, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP\Route;
  25. interface IRoute {
  26. /**
  27. * Specify PATCH as the method to use with this route
  28. * @return \OCP\Route\IRoute
  29. */
  30. public function patch();
  31. /**
  32. * Specify the method when this route is to be used
  33. *
  34. * @param string $method HTTP method (uppercase)
  35. * @return \OCP\Route\IRoute
  36. */
  37. public function method($method);
  38. /**
  39. * The action to execute when this route matches, includes a file like
  40. * it is called directly
  41. *
  42. * @param string $file
  43. * @return void
  44. */
  45. public function actionInclude($file);
  46. /**
  47. * Specify GET as the method to use with this route
  48. * @return \OCP\Route\IRoute
  49. */
  50. public function get();
  51. /**
  52. * Specify POST as the method to use with this route
  53. * @return \OCP\Route\IRoute
  54. */
  55. public function post();
  56. /**
  57. * Specify DELETE as the method to use with this route
  58. * @return \OCP\Route\IRoute
  59. */
  60. public function delete();
  61. /**
  62. * The action to execute when this route matches
  63. *
  64. * @param string|callable $class the class or a callable
  65. * @param string $function the function to use with the class
  66. * @return \OCP\Route\IRoute
  67. *
  68. * This function is called with $class set to a callable or
  69. * to the class with $function
  70. */
  71. public function action($class, $function = null);
  72. /**
  73. * Defaults to use for this route
  74. *
  75. * @param array $defaults The defaults
  76. * @return \OCP\Route\IRoute
  77. */
  78. public function defaults($defaults);
  79. /**
  80. * Requirements for this route
  81. *
  82. * @param array $requirements The requirements
  83. * @return \OCP\Route\IRoute
  84. */
  85. public function requirements($requirements);
  86. /**
  87. * Specify PUT as the method to use with this route
  88. * @return \OCP\Route\IRoute
  89. */
  90. public function put();
  91. }