iroute.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OCP\Route;
  9. interface IRoute {
  10. /**
  11. * Specify PATCH as the method to use with this route
  12. * @return \OCP\Route\IRoute
  13. */
  14. public function patch();
  15. /**
  16. * Specify the method when this route is to be used
  17. *
  18. * @param string $method HTTP method (uppercase)
  19. * @return \OCP\Route\IRoute
  20. */
  21. public function method($method);
  22. /**
  23. * The action to execute when this route matches, includes a file like
  24. * it is called directly
  25. *
  26. * @param string $file
  27. * @return void
  28. */
  29. public function actionInclude($file);
  30. /**
  31. * Specify GET as the method to use with this route
  32. * @return \OCP\Route\IRoute
  33. */
  34. public function get();
  35. /**
  36. * Specify POST as the method to use with this route
  37. * @return \OCP\Route\IRoute
  38. */
  39. public function post();
  40. /**
  41. * Specify DELETE as the method to use with this route
  42. * @return \OCP\Route\IRoute
  43. */
  44. public function delete();
  45. /**
  46. * The action to execute when this route matches
  47. *
  48. * @param string|callable $class the class or a callable
  49. * @param string $function the function to use with the class
  50. * @return \OCP\Route\IRoute
  51. *
  52. * This function is called with $class set to a callable or
  53. * to the class with $function
  54. */
  55. public function action($class, $function = null);
  56. /**
  57. * Defaults to use for this route
  58. *
  59. * @param array $defaults The defaults
  60. * @return \OCP\Route\IRoute
  61. */
  62. public function defaults($defaults);
  63. /**
  64. * Requirements for this route
  65. *
  66. * @param array $requirements The requirements
  67. * @return \OCP\Route\IRoute
  68. */
  69. public function requirements($requirements);
  70. /**
  71. * Specify PUT as the method to use with this route
  72. * @return \OCP\Route\IRoute
  73. */
  74. public function put();
  75. }