| Conditions | 3 |
| Paths | 4 |
| Total Lines | 77 |
| Code Lines | 59 |
| 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 |
||
| 71 | public function queryRelationsBecomingInactive(int $idProductLabel, string $priceMode): SpyProductLabelProductAbstractQuery |
||
| 72 | { |
||
| 73 | /** @var \Orm\Zed\ProductLabel\Persistence\SpyProductLabelProductAbstractQuery $productLabelProductAbstractQuery */ |
||
| 74 | $productLabelProductAbstractQuery = $this->getFactory() |
||
| 75 | ->getProductLabelQueryContainer() |
||
| 76 | ->queryProductAbstractRelationsByIdProductLabel($idProductLabel) |
||
| 77 | ->distinct() |
||
| 78 | ->useSpyProductAbstractQuery(null, Criteria::LEFT_JOIN) |
||
| 79 | ->usePriceProductQuery('priceProductOrigin', Criteria::LEFT_JOIN) |
||
| 80 | ->joinPriceType('priceTypeOrigin', Criteria::INNER_JOIN) |
||
| 81 | ->addJoinCondition( |
||
| 82 | 'priceTypeOrigin', |
||
| 83 | 'priceTypeOrigin.name = ?', |
||
| 84 | static::PRICE_TYPE_ORIGINAL, |
||
| 85 | ) |
||
| 86 | ->usePriceProductStoreQuery('priceProductStoreOrigin', Criteria::LEFT_JOIN) |
||
| 87 | ->usePriceProductDefaultQuery('priceProductDefaultOriginal', Criteria::LEFT_JOIN) |
||
| 88 | ->endUse() |
||
| 89 | ->endUse() |
||
| 90 | ->endUse() |
||
| 91 | ->usePriceProductQuery('priceProductDefault', Criteria::LEFT_JOIN) |
||
| 92 | ->joinPriceType('priceTypeDefault', Criteria::INNER_JOIN) |
||
| 93 | ->addJoinCondition( |
||
| 94 | 'priceTypeDefault', |
||
| 95 | 'priceTypeDefault.name = ?', |
||
| 96 | static::PRICE_TYPE_DEFAULT, |
||
| 97 | ) |
||
| 98 | ->usePriceProductStoreQuery('priceProductStoreDefault', Criteria::LEFT_JOIN) |
||
| 99 | ->usePriceProductDefaultQuery('priceProductDefaultDefault', Criteria::LEFT_JOIN) |
||
| 100 | ->endUse() |
||
| 101 | ->endUse() |
||
| 102 | ->endUse() |
||
| 103 | ->endUse() |
||
| 104 | ->addAnd('priceProductDefaultOriginal.id_price_product_default', null, Criteria::ISNOTNULL) |
||
| 105 | ->addAnd('priceProductDefaultDefault.id_price_product_default', null, Criteria::ISNOTNULL) |
||
| 106 | ->addJoinCondition('priceProductStoreDefault', 'priceProductStoreOrigin.fk_store = priceProductStoreDefault.fk_store') |
||
| 107 | ->addJoinCondition('priceProductStoreDefault', 'priceProductStoreOrigin.fk_currency = priceProductStoreDefault.fk_currency'); |
||
| 108 | |||
| 109 | if ($priceMode === static::PRICE_MODE_GROSS) { |
||
| 110 | $productLabelProductAbstractQuery->addAnd( |
||
| 111 | $this->getBasicModelCriterion( |
||
| 112 | $productLabelProductAbstractQuery, |
||
| 113 | 'priceProductStoreOrigin.gross_price < priceProductStoreDefault.gross_price', |
||
| 114 | 'priceProductStoreOrigin.gross_price', |
||
| 115 | ), |
||
| 116 | ) |
||
| 117 | ->addOr( |
||
| 118 | $this->getBasicModelCriterion( |
||
| 119 | $productLabelProductAbstractQuery, |
||
| 120 | 'priceProductStoreOrigin.gross_price = priceProductStoreDefault.gross_price', |
||
| 121 | 'priceProductStoreOrigin.gross_price', |
||
| 122 | ), |
||
| 123 | ) |
||
| 124 | ->addOr($productLabelProductAbstractQuery->getNewCriterion('priceProductStoreOrigin.gross_price', null, Criteria::ISNULL) |
||
| 125 | ->addOr($productLabelProductAbstractQuery->getNewCriterion('priceProductStoreDefault.gross_price', null, Criteria::ISNULL))); |
||
| 126 | } |
||
| 127 | |||
| 128 | if ($priceMode === static::PRICE_MODE_NET) { |
||
| 129 | $productLabelProductAbstractQuery->addAnd( |
||
| 130 | $this->getBasicModelCriterion( |
||
| 131 | $productLabelProductAbstractQuery, |
||
| 132 | 'priceProductStoreOrigin.net_price < priceProductStoreDefault.net_price', |
||
| 133 | 'priceProductStoreOrigin.net_price', |
||
| 134 | ), |
||
| 135 | ) |
||
| 136 | ->addOr( |
||
| 137 | $this->getBasicModelCriterion( |
||
| 138 | $productLabelProductAbstractQuery, |
||
| 139 | 'priceProductStoreOrigin.net_price = priceProductStoreDefault.net_price', |
||
| 140 | 'priceProductStoreOrigin.net_price', |
||
| 141 | ), |
||
| 142 | ) |
||
| 143 | ->addOr($productLabelProductAbstractQuery->getNewCriterion('priceProductStoreOrigin.net_price', null, Criteria::ISNULL) |
||
| 144 | ->addAnd($productLabelProductAbstractQuery->getNewCriterion('priceProductStoreDefault.net_price', null, Criteria::ISNULL))); |
||
| 145 | } |
||
| 146 | |||
| 147 | return $productLabelProductAbstractQuery; |
||
| 148 | } |
||
| 247 |
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