1
0

irouter.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <icewind@owncloud.com>
  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 IRouter {
  26. /**
  27. * Get the files to load the routes from
  28. *
  29. * @return string[]
  30. */
  31. public function getRoutingFiles();
  32. /**
  33. * @return string
  34. */
  35. public function getCacheKey();
  36. /**
  37. * loads the api routes
  38. * @return void
  39. */
  40. public function loadRoutes($app = null);
  41. /**
  42. * Sets the collection to use for adding routes
  43. *
  44. * @param string $name Name of the collection to use.
  45. * @return void
  46. */
  47. public function useCollection($name);
  48. /**
  49. * returns the current collection name in use for adding routes
  50. *
  51. * @return string the collection name
  52. */
  53. public function getCurrentCollection();
  54. /**
  55. * Create a \OCP\Route\IRoute.
  56. *
  57. * @param string $name Name of the route to create.
  58. * @param string $pattern The pattern to match
  59. * @param array $defaults An array of default parameter values
  60. * @param array $requirements An array of requirements for parameters (regexes)
  61. * @return \OCP\Route\IRoute
  62. */
  63. public function create($name, $pattern, array $defaults = array(), array $requirements = array());
  64. /**
  65. * Find the route matching $url.
  66. *
  67. * @param string $url The url to find
  68. * @throws \Exception
  69. * @return void
  70. */
  71. public function match($url);
  72. /**
  73. * Get the url generator
  74. *
  75. */
  76. public function getGenerator();
  77. /**
  78. * Generate url based on $name and $parameters
  79. *
  80. * @param string $name Name of the route to use.
  81. * @param array $parameters Parameters for the route
  82. * @param bool $absolute
  83. * @return string
  84. */
  85. public function generate($name, $parameters = array(), $absolute = false);
  86. }