1 | <?php |
||||
2 | |||||
3 | use Nip\Request; |
||||
4 | use Nip\Router\Route\Route; |
||||
5 | use Nip\Router\RouteFactory; |
||||
6 | use Nip\Router\Router; |
||||
7 | use Nip\Router\Tests\Fixtures\Application\Library\Router\Route\StandardRoute; |
||||
8 | |||||
9 | /** |
||||
10 | * Class MatchingBench |
||||
11 | * @Iterations(5) |
||||
12 | * @Revs(100) |
||||
13 | * @BeforeMethods({"init"}) |
||||
14 | */ |
||||
15 | class MatchingBench |
||||
16 | { |
||||
17 | /** |
||||
18 | * @var Router |
||||
19 | */ |
||||
20 | protected $router; |
||||
21 | |||||
22 | public function benchStaticRoutesNip() |
||||
23 | { |
||||
24 | $request = Request::create('/index999'); |
||||
25 | $this->router->route($request); |
||||
0 ignored issues
–
show
|
|||||
26 | } |
||||
27 | |||||
28 | public function benchDynamicRoutesNip() |
||||
29 | { |
||||
30 | $request = Request::create('/999/posts/create'); |
||||
31 | $this->router->route($request); |
||||
0 ignored issues
–
show
The function
Nip\Router\Router::route() has been deprecated: Use matchRequest($request)
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
32 | } |
||||
33 | |||||
34 | public function benchStaticRoutesSymfony() |
||||
35 | { |
||||
36 | $request = Request::create('/index999'); |
||||
37 | $this->router->matchRequest($request); |
||||
38 | } |
||||
39 | |||||
40 | public function benchDynamicRoutesSymfony() |
||||
41 | { |
||||
42 | $request = Request::create('/999/posts/create'); |
||||
43 | $this->router->matchRequest($request); |
||||
44 | } |
||||
45 | |||||
46 | public function init() |
||||
47 | { |
||||
48 | $this->router = new Router(); |
||||
49 | $collection = $this->router->getRoutes(); |
||||
50 | |||||
51 | for ($i = 0; $i < 1000; ++$i) { |
||||
52 | RouteFactory::generateLiteralRoute( |
||||
53 | $collection, |
||||
54 | "index." . $i, |
||||
55 | Route::class, |
||||
56 | "", |
||||
57 | "/index" . $i); |
||||
58 | |||||
59 | RouteFactory::generateStandardRoute( |
||||
60 | $collection, |
||||
61 | "index.standard" . $i, |
||||
62 | StandardRoute::class, |
||||
63 | "/".$i); |
||||
64 | } |
||||
65 | } |
||||
66 | } |
||||
67 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.