Total Complexity | 1 |
Total Lines | 14 |
Duplicated Lines | 100 % |
Changes | 0 |
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 |
||
20 | class LocalePluginTest extends TestCase |
||
21 | { |
||
22 | public function testPlugin() |
||
23 | { |
||
24 | $query = GeocodeQuery::create('foo'); |
||
25 | $first = function (Query $query) { |
||
26 | $this->fail('Plugin should not restart the chain'); |
||
27 | }; |
||
28 | $next = function (Query $query) { |
||
29 | $this->assertEquals('sv', $query->getLocale()); |
||
30 | }; |
||
31 | |||
32 | $plugin = new LocalePlugin('sv'); |
||
33 | $plugin->handleQuery($query, $next, $first); |
||
34 | } |
||
36 |