Skip to content

Commit

Permalink
Updating comments and documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Scheffler committed Jun 5, 2022
1 parent 74e0080 commit bfbc060
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 51 deletions.
2 changes: 2 additions & 0 deletions src/Router/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class Route
/**
* Compiled regular expression for path matching.
*
* This will be compiled lazily as needed.
*
* @var string|null
*/
private ?string $path_regex = null;
Expand Down
98 changes: 49 additions & 49 deletions src/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ public function getSupportedMethods(ServerRequestInterface $request): array
/**
* Add a GET route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function get(
Expand All @@ -191,12 +191,12 @@ public function get(
/**
* Add a POST route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function post(
Expand All @@ -221,12 +221,12 @@ public function post(
/**
* Add a PUT route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function put(
Expand All @@ -251,12 +251,12 @@ public function put(
/**
* Add a PATCH route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function patch(
Expand All @@ -281,12 +281,12 @@ public function patch(
/**
* Add a DELETE route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function delete(
Expand All @@ -311,12 +311,12 @@ public function delete(
/**
* Add a HEAD route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function head(
Expand All @@ -341,12 +341,12 @@ public function head(
/**
* Add an OPTIONS route.
*
* @param string $path
* @param string|callable $handler
* @param string|null $scheme
* @param array<string> $hostnames
* @param array<string|MiddlewareInterface> $middleware
* @param array<string,mixed> $attributes
* @param string $path The URI path this route will respond to.
* @param string|callable $handler The handler for this route.
* @param string|null $scheme The scheme this route responds to (http or https). Null responds to any.
* @param array<string> $hostnames Hostnames this route responds to.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to this route.
* @param array<string,mixed> $attributes Key value pair of attributes to be passed to ServerRequestInterface instance.
* @return Route
*/
public function options(
Expand All @@ -371,13 +371,13 @@ public function options(
/**
* Group routes together with a set of shared configuration options.
*
* @param callable $routes
* @param string|null $namespace
* @param string|null $prefix
* @param string|null $scheme
* @param array<string|MiddlewareInterface> $middleware
* @param array<string> $hostnames
* @param array<string,mixed> $attributes
* @param callable $routes A callable that accepts the Router instance.
* @param string|null $namespace Namespace prepended to all string based handlers.
* @param string|null $prefix URI prefix predended to all paths.
* @param string|null $scheme Scheme (https or https) that routes will respond to. Null responds to any.
* @param array<string|MiddlewareInterface> $middleware Middleware to be applied to all routes.
* @param array<string> $hostnames Hostnames that routes will respond to.
* @param array<string,mixed> $attributes Key value pair of attributes that will be passed to ServerRequestInterface instance.
* @return void
*/
public function group(
Expand Down
4 changes: 2 additions & 2 deletions src/Router/RouterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function add(
): Route;

/**
* Match a ServerReqeuestInterface instance to a Route. Returns null of no route
* Match a ServerReqeuestInterface instance to a Route. Returns null if no route
* matched request.
*
* @param ServerRequestInterface $request
Expand All @@ -39,7 +39,7 @@ public function add(
public function resolve(ServerRequestInterface $request): ?Route;

/**
* Given a ServerRequestInterface instance, return which methods that endpoint accepts.
* Given a ServerRequestInterface instance, return which methods that endpoint responds to.
*
* @param ServerRequestInterface $request
* @return array<string>
Expand Down

0 comments on commit bfbc060

Please sign in to comment.