Skip to content

Commit ea8455f

Browse files
committed
Improve the class documentation
1 parent d822a1d commit ea8455f

File tree

1 file changed

+20
-2
lines changed
  • packages/framework/src/Foundation/Facades

1 file changed

+20
-2
lines changed

packages/framework/src/Foundation/Facades/Routes.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,46 @@ public static function getFacadeRoot(): RouteCollection
2424
return HydeKernel::getInstance()->routes();
2525
}
2626

27+
/**
28+
* Check if a route exists by its route key.
29+
*/
2730
public static function exists(string $routeKey): bool
2831
{
2932
return static::getFacadeRoot()->has($routeKey);
3033
}
3134

35+
/**
36+
* Try to get a route by its route key. If it doesn't exist, null is returned.
37+
*/
3238
public static function find(string $routeKey): ?Route
3339
{
3440
return static::getFacadeRoot()->get($routeKey);
3541
}
3642

37-
/** @throws \Hyde\Framework\Exceptions\RouteNotFoundException */
43+
/**
44+
* Get a route by its route key. If it doesn't exist, an exception is thrown.
45+
*
46+
* @throws \Hyde\Framework\Exceptions\RouteNotFoundException
47+
*/
3848
public static function get(string $routeKey): Route
3949
{
4050
return static::getFacadeRoot()->getRoute($routeKey);
4151
}
4252

53+
/**
54+
* Get all the routes for the site as a collection of route instances, keyed by route key.
55+
*
56+
* @return \Hyde\Foundation\Kernel\RouteCollection<string, \Hyde\Support\Models\Route>
57+
*/
4358
public static function all(): RouteCollection
4459
{
4560
return static::getFacadeRoot()->getRoutes();
4661
}
4762

48-
/** Get the current route for the page being rendered. */
63+
/**
64+
* Get the route instance for the page currently being rendered.
65+
* If a render is not in progress, this will return null.
66+
*/
4967
public static function current(): ?Route
5068
{
5169
return Hyde::currentRoute();

0 commit comments

Comments
 (0)