You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.1 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016, ownCloud, Inc.
  5. *
  6. * @author Bart Visscher <bartv@thisnet.nl>
  7. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  8. * @author Joas Schilling <coding@schilljs.com>
  9. * @author Julius Härtl <jus@bitgrid.net>
  10. * @author Morris Jobke <hey@morrisjobke.de>
  11. * @author Roeland Jago Douma <roeland@famdouma.nl>
  12. * @author Thomas Müller <thomas.mueller@tmit.eu>
  13. *
  14. * @license AGPL-3.0
  15. *
  16. * This code is free software: you can redistribute it and/or modify
  17. * it under the terms of the GNU Affero General Public License, version 3,
  18. * as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU Affero General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU Affero General Public License, version 3,
  26. * along with this program. If not, see <http://www.gnu.org/licenses/>
  27. *
  28. */
  29. namespace OCP;
  30. /**
  31. * Class to generate URLs
  32. * @since 6.0.0
  33. */
  34. interface IURLGenerator {
  35. /**
  36. * Returns the URL for a route
  37. * @param string $routeName the name of the route
  38. * @param array $arguments an array with arguments which will be filled into the url
  39. * @return string the url
  40. * @since 6.0.0
  41. */
  42. public function linkToRoute(string $routeName, array $arguments = []): string;
  43. /**
  44. * Returns the absolute URL for a route
  45. * @param string $routeName the name of the route
  46. * @param array $arguments an array with arguments which will be filled into the url
  47. * @return string the absolute url
  48. * @since 8.0.0
  49. */
  50. public function linkToRouteAbsolute(string $routeName, array $arguments = []): string;
  51. /**
  52. * @param string $routeName
  53. * @param array $arguments
  54. * @return string
  55. * @since 15.0.0
  56. */
  57. public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string;
  58. /**
  59. * Returns an URL for an image or file
  60. * @param string $appName the name of the app
  61. * @param string $file the name of the file
  62. * @param array $args array with param=>value, will be appended to the returned url
  63. * The value of $args will be urlencoded
  64. * @return string the url
  65. * @since 6.0.0
  66. */
  67. public function linkTo(string $appName, string $file, array $args = []): string;
  68. /**
  69. * Returns the link to an image, like linkTo but only with prepending img/
  70. * @param string $appName the name of the app
  71. * @param string $file the name of the file
  72. * @return string the url
  73. * @since 6.0.0
  74. */
  75. public function imagePath(string $appName, string $file): string;
  76. /**
  77. * Makes an URL absolute
  78. * @param string $url the url in the ownCloud host
  79. * @return string the absolute version of the url
  80. * @since 6.0.0
  81. */
  82. public function getAbsoluteURL(string $url): string;
  83. /**
  84. * @param string $key
  85. * @return string url to the online documentation
  86. * @since 8.0.0
  87. */
  88. public function linkToDocs(string $key): string;
  89. /**
  90. * @return string base url of the current request
  91. * @since 13.0.0
  92. */
  93. public function getBaseUrl(): string;
  94. }