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 namespace XoopsModules\Pedigree; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Class Pedigree\Breadcrumb |
||
| 35 | */ |
||
| 36 | class Breadcrumb |
||
| 37 | { |
||
| 38 | public $dirname; |
||
| 39 | private $bread = []; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * |
||
| 43 | */ |
||
| 44 | public function __construct() |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Add link to breadcrumb |
||
| 51 | * |
||
| 52 | * @param string $title |
||
| 53 | * @param string $link |
||
| 54 | */ |
||
| 55 | public function addLink($title = '', $link = '') |
||
| 60 | ]; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Render Pedigree BreadCrumb |
||
| 65 | * |
||
| 66 | */ |
||
| 67 | public function render() |
||
| 68 | { |
||
| 69 | if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
||
| 70 | require_once $GLOBALS['xoops']->path('class/theme.php'); |
||
| 71 | $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
||
|
|
|||
| 72 | } |
||
| 73 | |||
| 74 | require_once $GLOBALS['xoops']->path('class/template.php'); |
||
| 75 | $breadcrumbTpl = new \XoopsTpl(); |
||
| 76 | $breadcrumbTpl->assign('breadcrumb', $this->bread); |
||
| 77 | $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
||
| 78 | unset($breadcrumbTpl); |
||
| 79 | |||
| 83 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths