| Conditions | 3 |
| Paths | 4 |
| Total Lines | 73 |
| Code Lines | 53 |
| 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 |
||
| 172 | public function queryRelationsBecomingActive( |
||
| 173 | int $idProductLabel, |
||
| 174 | int $currentStoreId, |
||
| 175 | int $currentCurrencyId, |
||
| 176 | string $priceMode, |
||
| 177 | ): SpyProductAbstractQuery { |
||
| 178 | /** @var \Orm\Zed\Product\Persistence\SpyProductAbstractQuery $productAbstractQuery */ |
||
| 179 | $productAbstractQuery = $this->getFactory() |
||
| 180 | ->getProductQueryContainer() |
||
| 181 | ->queryProductAbstract() |
||
| 182 | ->distinct() |
||
| 183 | ->usePriceProductQuery('priceProductOrigin', Criteria::LEFT_JOIN) |
||
| 184 | ->joinPriceType('priceTypeOrigin', Criteria::INNER_JOIN) |
||
| 185 | ->addJoinCondition( |
||
| 186 | 'priceTypeOrigin', |
||
| 187 | 'priceTypeOrigin.name = ?', |
||
| 188 | static::PRICE_TYPE_ORIGINAL, |
||
| 189 | ) |
||
| 190 | ->usePriceProductStoreQuery('priceProductStoreOrigin', Criteria::LEFT_JOIN) |
||
| 191 | ->usePriceProductDefaultQuery('priceProductDefaultOriginal', Criteria::LEFT_JOIN) |
||
| 192 | ->endUse() |
||
| 193 | ->endUse() |
||
| 194 | ->endUse() |
||
| 195 | ->usePriceProductQuery('priceProductDefault', Criteria::LEFT_JOIN) |
||
| 196 | ->joinPriceType('priceTypeDefault', Criteria::INNER_JOIN) |
||
| 197 | ->addJoinCondition( |
||
| 198 | 'priceTypeDefault', |
||
| 199 | 'priceTypeDefault.name = ?', |
||
| 200 | static::PRICE_TYPE_DEFAULT, |
||
| 201 | ) |
||
| 202 | ->usePriceProductStoreQuery('priceProductStoreDefault', Criteria::LEFT_JOIN) |
||
| 203 | ->usePriceProductDefaultQuery('priceProductDefaultDefault', Criteria::LEFT_JOIN) |
||
| 204 | ->endUse() |
||
| 205 | ->endUse() |
||
| 206 | ->endUse() |
||
| 207 | ->useSpyProductLabelProductAbstractQuery('rel', Criteria::LEFT_JOIN) |
||
| 208 | ->endUse() |
||
| 209 | ->addJoin( |
||
| 210 | ['rel.fk_product_abstract', SpyProductLabelProductAbstractTableMap::COL_FK_PRODUCT_LABEL], |
||
| 211 | [SpyProductLabelProductAbstractTableMap::COL_FK_PRODUCT_ABSTRACT, $idProductLabel], |
||
| 212 | Criteria::LEFT_JOIN, |
||
| 213 | ) |
||
| 214 | ->addJoinCondition('priceProductStoreDefault', 'priceProductDefault.id_price_product=priceProductStoreDefault.fk_price_product') |
||
| 215 | ->addJoinCondition('priceProductStoreDefault', 'priceProductStoreOrigin.fk_store = priceProductStoreDefault.fk_store') |
||
| 216 | ->addJoinCondition('priceProductStoreDefault', 'priceProductStoreOrigin.fk_currency = priceProductStoreDefault.fk_currency'); |
||
| 217 | |||
| 218 | $productAbstractQuery->addAnd(SpyProductLabelProductAbstractTableMap::COL_FK_PRODUCT_ABSTRACT, null, Criteria::ISNULL); |
||
| 219 | $productAbstractQuery->addAnd('priceProductStoreOrigin.fk_store', $currentStoreId, Criteria::EQUAL); |
||
| 220 | $productAbstractQuery->addAnd('priceProductStoreOrigin.fk_currency', $currentCurrencyId, Criteria::EQUAL); |
||
| 221 | $productAbstractQuery->addAnd('priceProductStoreDefault.fk_store', $currentStoreId, Criteria::EQUAL); |
||
| 222 | $productAbstractQuery->addAnd('priceProductStoreDefault.fk_currency', $currentCurrencyId, Criteria::EQUAL); |
||
| 223 | |||
| 224 | if ($priceMode === static::PRICE_MODE_GROSS) { |
||
| 225 | $productAbstractQuery->addAnd( |
||
| 226 | $this->getBasicModelCriterion( |
||
| 227 | $productAbstractQuery, |
||
| 228 | 'priceProductStoreOrigin.gross_price > priceProductStoreDefault.gross_price', |
||
| 229 | 'priceProductStoreOrigin.gross_price', |
||
| 230 | ), |
||
| 231 | ); |
||
| 232 | } |
||
| 233 | |||
| 234 | if ($priceMode === static::PRICE_MODE_NET) { |
||
| 235 | $productAbstractQuery->addAnd( |
||
| 236 | $this->getBasicModelCriterion( |
||
| 237 | $productAbstractQuery, |
||
| 238 | 'priceProductStoreOrigin.net_price > priceProductStoreDefault.net_price', |
||
| 239 | 'priceProductStoreOrigin.net_price', |
||
| 240 | ), |
||
| 241 | ); |
||
| 242 | } |
||
| 243 | |||
| 244 | return $productAbstractQuery; |
||
| 245 | } |
||
| 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