Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
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); |
||
|
|||
26 | } |
||
27 | |||
28 | public function benchDynamicRoutesNip() |
||
29 | { |
||
30 | $request = Request::create('/999/posts/create'); |
||
31 | $this->router->route($request); |
||
32 | } |
||
33 | |||
34 | public function benchStaticRoutesSymfony() |
||
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() |
||
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.