• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tempestphp / tempest-framework / 14036710048

24 Mar 2025 01:37PM UTC coverage: 79.292%. First build
14036710048

Pull #1059

github

web-flow
Merge 3bad7daf0 into f3cf45514
Pull Request #1059: feat(router): allow checking an action against the current route

7 of 17 new or added lines in 2 files covered. (41.18%)

10488 of 13227 relevant lines covered (79.29%)

91.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/Tempest/Router/src/functions.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest {
6
    use Tempest\Reflection\MethodReflector;
7
    use Tempest\Router\Router;
8

9
    /**
10
     * Creates a valid URI to the given controller `$action`.
11
     */
12
    function uri(array|string|MethodReflector $action, mixed ...$params): string
13
    {
14
        if ($action instanceof MethodReflector) {
14✔
15
            $action = [
2✔
16
                $action->getDeclaringClass()->getName(),
2✔
17
                $action->getName(),
2✔
18
            ];
2✔
19
        }
20

21
        $router = get(Router::class);
14✔
22

23
        return $router->toUri(
14✔
24
            $action,
14✔
25
            ...$params,
14✔
26
        );
14✔
27
    }
28

29
    /**
30
     * Checks whether the given controller action matches the current URI.
31
     */
32
    function is_uri(array|string|MethodReflector $action, mixed ...$params): bool
33
    {
NEW
34
        if ($action instanceof MethodReflector) {
×
NEW
35
            $action = [
×
NEW
36
                $action->getDeclaringClass()->getName(),
×
NEW
37
                $action->getName(),
×
NEW
38
            ];
×
39
        }
40

NEW
41
        $router = get(Router::class);
×
42

NEW
43
        return $router->isCurrentUri(
×
NEW
44
            $action,
×
NEW
45
            ...$params,
×
NEW
46
        );
×
47
    }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc