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