Total Complexity | 2 |
Total Lines | 21 |
Duplicated Lines | 42.86 % |
Coverage | 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 |
||
19 | abstract class ContainerTestCase extends KernelTestCase |
||
20 | { |
||
21 | /** |
||
22 | * @var ContainerInterface |
||
23 | */ |
||
24 | private $container; |
||
25 | |||
26 | /** |
||
27 | * Getter method for container |
||
28 | * |
||
29 | * @return ContainerInterface |
||
30 | */ |
||
31 | public function getContainer(): ContainerInterface |
||
32 | { |
||
33 | if (!($this->container instanceof ContainerInterface)) { |
||
34 | self::bootKernel(); |
||
35 | |||
36 | $this->container = static::$kernel->getContainer(); |
||
37 | } |
||
38 | |||
39 | return $this->container; |
||
40 | } |
||
42 |