| Conditions | 4 |
| Paths | 4 |
| Total Lines | 58 |
| Code Lines | 40 |
| 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 |
||
| 104 | protected function mapElasticaHits(array $searchResult): array |
||
| 105 | { |
||
| 106 | |||
| 107 | $total = $searchResult[static::KEY_TOTAL_HITS]; |
||
| 108 | $maxScore = max($searchResult[static::KEY_SCORE_FIRST_HIT], $searchResult[static::KEY_SCORE_LAST_HIT]); |
||
| 109 | $elasticaHits = []; |
||
| 110 | foreach ($searchResult[static::KEY_HITS] as $searchHit) { |
||
| 111 | if (!count($searchHit[static::KEY_VARIANT_VALUES])) { |
||
| 112 | continue; |
||
| 113 | } |
||
| 114 | |||
| 115 | $productAbstract = $this->productStorageClient |
||
| 116 | ->findProductAbstractStorageDataByMapping( |
||
| 117 | static::SKU_MAPPING_TYPE, |
||
| 118 | $searchHit[static::KEY_OPTION_ID], |
||
| 119 | $this->currentLocale |
||
| 120 | ); |
||
| 121 | if ($productAbstract === null) { |
||
| 122 | continue; |
||
| 123 | } |
||
| 124 | $productAbstractImageStorageTransfer = $this->productImageStorageClient |
||
| 125 | ->findProductImageAbstractStorageTransfer( |
||
| 126 | $productAbstract[static::KEY_ID_PRODUCT_ABSTRACT], |
||
| 127 | $this->currentLocale |
||
| 128 | ); |
||
| 129 | |||
| 130 | $elasticaImages = $this->mapElasticaImages($productAbstractImageStorageTransfer); |
||
| 131 | $elasticaPrices = $this->mapElasticaPrices($productAbstract); |
||
| 132 | |||
| 133 | $elasticaHit = [ |
||
| 134 | static::KEY_INDEX => $this->currentLocale . static::KEY_SEARCH, |
||
| 135 | static::KEY_TYPE => static::KEY_PAGE, |
||
| 136 | static::KEY_ID => $productAbstract[static::KEY_ID_PRODUCT_ABSTRACT], |
||
| 137 | static::KEY_SCORE => $searchHit[static::KEY_SCORE], |
||
| 138 | static::KEY_SOURCE => |
||
| 139 | [ |
||
| 140 | static::KEY_SEARCH_RESULT_DATA => |
||
| 141 | [ |
||
| 142 | static::KEY_IMAGES => $elasticaImages, |
||
| 143 | static::KEY_ID_PRODUCT_LABELS => [], |
||
| 144 | static::KEY_PRICE => 0, |
||
| 145 | static::KEY_ABSTRACT_NAME => $productAbstract[static::KEY_NAME], |
||
| 146 | static::KEY_ID_PRODUCT_ABSTRACT => $productAbstract[static::KEY_ID_PRODUCT_ABSTRACT], |
||
| 147 | static::KEY_OPTION_TYPE => static::KEY_PRODUCT_ABSTRACT, |
||
| 148 | static::KEY_PRICES => $elasticaPrices, |
||
| 149 | static::KEY_ABSTRACT_SKU => $productAbstract[static::KEY_SKU], |
||
| 150 | static::KEY_URL => $productAbstract[static::KEY_URL], |
||
| 151 | ], |
||
| 152 | ], |
||
| 153 | ]; |
||
| 154 | |||
| 155 | $elasticaHits[] = $elasticaHit; |
||
| 156 | } |
||
| 157 | |||
| 158 | return [ |
||
| 159 | static::KEY_TOTAL => $total, |
||
| 160 | static::KEY_MAX_SCORE => $maxScore, |
||
| 161 | static::KEY_HITS => $elasticaHits, |
||
| 162 | ]; |
||
| 185 |
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