Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 13 |
Lines | 16 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | View Code Duplication | protected function createConstructor($metadata) |
|
|
|||
22 | { |
||
23 | $class = "\n\t" . '/**'; |
||
24 | $class .= "\n\t" . ' * @param ViewInterface $renderer Rendering instance'; |
||
25 | $class .= "\n\t" . ' * @param QueryInterface $query Database query instance'; |
||
26 | $class .= "\n\t" . ' * @param string $locale Localization identifier'; |
||
27 | $class .= "\n\t" . ' */'; |
||
28 | $class .= "\n\t" . 'public function __construct(ViewInterface $renderer, QueryInterface $query = null, $locale = null)'; |
||
29 | $class .= "\n\t" . '{'; |
||
30 | $class .= "\n\t\t" . '$this->renderer = $renderer;'; |
||
31 | $class .= "\n\t\t" . '$container = $GLOBALS[\'__core\']->getContainer();'; |
||
32 | $class .= "\n\t\t" . 'parent::__construct($locale, $query ?? $container->get("query"));'; |
||
33 | $class .= "\n\t" . '}'; |
||
34 | |||
35 | $this->generator->text($class); |
||
36 | } |
||
37 | } |
||
39 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.