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

nette / application / 27919019709

21 Jun 2026 10:08PM UTC coverage: 84.111% (+0.05%) from 84.059%
27919019709

push

github

dg
phpstan fix

2038 of 2423 relevant lines covered (84.11%)

0.84 hits per line

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

45.45
/src/Application/Routers/SimpleRouter.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Nette Framework (https://nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Nette\Application\Routers;
9

10
use Nette;
11
use Nette\Application;
12
use function is_string;
13

14

15
/**
16
 * The bidirectional route for trivial routing via query parameters.
17
 */
18
final class SimpleRouter extends Nette\Routing\SimpleRouter implements Nette\Routing\Router
19
{
20
        private const PresenterKey = 'presenter';
21

22

23
        /** @param  array<string, mixed>|string  $defaults */
24
        public function __construct(array|string $defaults = [])
1✔
25
        {
26
                if (is_string($defaults)) {
1✔
27
                        [$presenter, $action] = Nette\Application\Helpers::splitName($defaults);
×
28
                        if (!$presenter) {
×
29
                                throw new Nette\InvalidArgumentException("Argument must be array or string in format Presenter:action, '$defaults' given.");
×
30
                        }
31

32
                        $defaults = [
×
33
                                self::PresenterKey => $presenter,
×
34
                                'action' => $action === '' ? Application\UI\Presenter::DefaultAction : $action,
×
35
                        ];
36
                }
37

38
                parent::__construct($defaults);
1✔
39
        }
1✔
40
}
41

42

43
interface_exists(Nette\Application\IRouter::class);
1✔
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