Просмотр файла vendor/slim/slim/Slim/Interfaces/RouteCollectorProxyInterface.php

Размер файла: 3.42Kb
  1. <?php
  2.  
  3. /**
  4. * Slim Framework (https://slimframework.com)
  5. *
  6. * @license https://github.com/slimphp/Slim/blob/4.x/LICENSE.md (MIT License)
  7. */
  8.  
  9. declare(strict_types=1);
  10.  
  11. namespace Slim\Interfaces;
  12.  
  13. use Psr\Container\ContainerInterface;
  14. use Psr\Http\Message\ResponseFactoryInterface;
  15. use Psr\Http\Message\UriInterface;
  16.  
  17. interface RouteCollectorProxyInterface
  18. {
  19. public function getResponseFactory(): ResponseFactoryInterface;
  20.  
  21. public function getCallableResolver(): CallableResolverInterface;
  22.  
  23. public function getContainer(): ?ContainerInterface;
  24.  
  25. public function getRouteCollector(): RouteCollectorInterface;
  26.  
  27. /**
  28. * Get the RouteCollectorProxy's base path
  29. */
  30. public function getBasePath(): string;
  31.  
  32. /**
  33. * Set the RouteCollectorProxy's base path
  34. */
  35. public function setBasePath(string $basePath): RouteCollectorProxyInterface;
  36.  
  37. /**
  38. * Add GET route
  39. *
  40. * @param string $pattern The route URI pattern
  41. * @param callable|string $callable The route callback routine
  42. */
  43. public function get(string $pattern, $callable): RouteInterface;
  44.  
  45. /**
  46. * Add POST route
  47. *
  48. * @param string $pattern The route URI pattern
  49. * @param callable|string $callable The route callback routine
  50. */
  51. public function post(string $pattern, $callable): RouteInterface;
  52.  
  53. /**
  54. * Add PUT route
  55. *
  56. * @param string $pattern The route URI pattern
  57. * @param callable|string $callable The route callback routine
  58. */
  59. public function put(string $pattern, $callable): RouteInterface;
  60.  
  61. /**
  62. * Add PATCH route
  63. *
  64. * @param string $pattern The route URI pattern
  65. * @param callable|string $callable The route callback routine
  66. */
  67. public function patch(string $pattern, $callable): RouteInterface;
  68.  
  69. /**
  70. * Add DELETE route
  71. *
  72. * @param string $pattern The route URI pattern
  73. * @param callable|string $callable The route callback routine
  74. */
  75. public function delete(string $pattern, $callable): RouteInterface;
  76.  
  77. /**
  78. * Add OPTIONS route
  79. *
  80. * @param string $pattern The route URI pattern
  81. * @param callable|string $callable The route callback routine
  82. */
  83. public function options(string $pattern, $callable): RouteInterface;
  84.  
  85. /**
  86. * Add route for any HTTP method
  87. *
  88. * @param string $pattern The route URI pattern
  89. * @param callable|string $callable The route callback routine
  90. */
  91. public function any(string $pattern, $callable): RouteInterface;
  92.  
  93. /**
  94. * Add route with multiple methods
  95. *
  96. * @param string[] $methods Numeric array of HTTP method names
  97. * @param string $pattern The route URI pattern
  98. * @param callable|string $callable The route callback routine
  99. */
  100. public function map(array $methods, string $pattern, $callable): RouteInterface;
  101.  
  102. /**
  103. * Route Groups
  104. *
  105. * This method accepts a route pattern and a callback. All route
  106. * declarations in the callback will be prepended by the group(s)
  107. * that it is in.
  108. * @param string|callable $callable
  109. */
  110. public function group(string $pattern, $callable): RouteGroupInterface;
  111.  
  112. /**
  113. * Add a route that sends an HTTP redirect
  114. *
  115. * @param string|UriInterface $to
  116. */
  117. public function redirect(string $from, $to, int $status = 302): RouteInterface;
  118. }