| Conditions | 10 |
| Paths | 72 |
| Total Lines | 38 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 37 | public function findDemanded(CategoryDemand $demand): QueryResultInterface |
||
| 38 | { |
||
| 39 | $constraints = []; |
||
| 40 | $query = $this->createQuery(); |
||
| 41 | |||
| 42 | if ($demand->getCategories() !== '') { |
||
| 43 | $query->getQuerySettings()->setRespectSysLanguage(false); |
||
| 44 | } |
||
| 45 | |||
| 46 | if ($demand->getRestrictToStoragePage()) { |
||
| 47 | $pidList = GeneralUtility::intExplode(',', $demand->getStoragePage(), true); |
||
| 48 | $constraints[] = $query->in('pid', $pidList); |
||
| 49 | } |
||
| 50 | |||
| 51 | if ($demand->getCategories()) { |
||
| 52 | if ($demand->getIncludeSubcategories()) { |
||
| 53 | $categoryList = CategoryService::getCategoryListWithChilds($demand->getCategories()); |
||
| 54 | $pidList = GeneralUtility::intExplode(',', $categoryList, true); |
||
| 55 | } else { |
||
| 56 | $pidList = GeneralUtility::intExplode(',', $demand->getCategories(), true); |
||
| 57 | } |
||
| 58 | $constraints[] = $query->in('uid', $pidList); |
||
| 59 | } |
||
| 60 | |||
| 61 | if (count($constraints) > 0) { |
||
| 62 | $query->matching($query->logicalAnd(...$constraints)); |
||
| 63 | } |
||
| 64 | |||
| 65 | if ($demand->getOrderField() !== '' && $demand->getOrderDirection() !== '' && |
||
| 66 | in_array($demand->getOrderField(), CategoryDemand::ORDER_FIELD_ALLOWED, true) |
||
| 67 | ) { |
||
| 68 | $orderings[$demand->getOrderField()] = ((strtolower($demand->getOrderDirection()) === 'desc') ? |
||
| 69 | QueryInterface::ORDER_DESCENDING : |
||
| 70 | QueryInterface::ORDER_ASCENDING); |
||
| 71 | $query->setOrderings($orderings); |
||
| 72 | } |
||
| 73 | |||
| 74 | return $query->execute(); |
||
| 75 | } |
||
| 77 |
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