| Conditions | 12 |
| Paths | 12 |
| Total Lines | 38 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 55 | protected static function getTreeList(int $id, int $depth, int $begin = 0, $permClause = '') |
||
| 56 | { |
||
| 57 | if ($id < 0) { |
||
| 58 | $id = abs($id); |
||
| 59 | } |
||
| 60 | if ($begin === 0) { |
||
| 61 | $theList = $id; |
||
| 62 | } else { |
||
| 63 | $theList = ''; |
||
| 64 | } |
||
| 65 | if ($id && $depth > 0) { |
||
| 66 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); |
||
|
|
|||
| 67 | $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); |
||
| 68 | $queryBuilder->select('uid') |
||
| 69 | ->from('pages') |
||
| 70 | ->where( |
||
| 71 | $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)), |
||
| 72 | $queryBuilder->expr()->eq('sys_language_uid', 0) |
||
| 73 | ) |
||
| 74 | ->orderBy('uid'); |
||
| 75 | if ($permClause !== '') { |
||
| 76 | $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($permClause)); |
||
| 77 | } |
||
| 78 | $statement = $queryBuilder->execute(); |
||
| 79 | while ($row = $statement->fetch()) { |
||
| 80 | if ($begin <= 0) { |
||
| 81 | $theList .= ',' . $row['uid']; |
||
| 82 | } |
||
| 83 | if ($depth > 1) { |
||
| 84 | $theSubList = self::getTreeList((int)$row['uid'], $depth - 1, $begin - 1, $permClause); |
||
| 85 | if (!empty($theList) && !empty($theSubList) && ($theSubList[0] !== ',')) { |
||
| 86 | $theList .= ','; |
||
| 87 | } |
||
| 88 | $theList .= $theSubList; |
||
| 89 | } |
||
| 90 | } |
||
| 91 | } |
||
| 92 | return $theList; |
||
| 93 | } |
||
| 95 |
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