| Conditions | 43 |
| Paths | 1 |
| Total Lines | 130 |
| Code Lines | 85 |
| 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 |
||
| 84 | public function withItemInfo(array $itemInfo) |
||
| 85 | { |
||
| 86 | $this->data['ItemInfo'] = $itemInfo; |
||
| 87 | foreach ($itemInfo as $depth1 => $depth1Value) { |
||
| 88 | if(isset($depth1Value['MemberPrice'])){ |
||
| 89 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.MemberPrice'] = $depth1Value['MemberPrice']; |
||
| 90 | } |
||
| 91 | if(isset($depth1Value['ActionPrice'])){ |
||
| 92 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ActionPrice'] = $depth1Value['ActionPrice']; |
||
| 93 | } |
||
| 94 | if(isset($depth1Value['ProductionPlace'])){ |
||
| 95 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ProductionPlace'] = $depth1Value['ProductionPlace']; |
||
| 96 | } |
||
| 97 | if(isset($depth1Value['BeSourceCode'])){ |
||
| 98 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BeSourceCode'] = $depth1Value['BeSourceCode']; |
||
| 99 | } |
||
| 100 | if(isset($depth1Value['StoreId'])){ |
||
| 101 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.StoreId'] = $depth1Value['StoreId']; |
||
| 102 | } |
||
| 103 | if(isset($depth1Value['BrandName'])){ |
||
| 104 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BrandName'] = $depth1Value['BrandName']; |
||
| 105 | } |
||
| 106 | if(isset($depth1Value['PromotionStart'])){ |
||
| 107 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionStart'] = $depth1Value['PromotionStart']; |
||
| 108 | } |
||
| 109 | if(isset($depth1Value['SourceCode'])){ |
||
| 110 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SourceCode'] = $depth1Value['SourceCode']; |
||
| 111 | } |
||
| 112 | if(isset($depth1Value['ItemId'])){ |
||
| 113 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemId'] = $depth1Value['ItemId']; |
||
| 114 | } |
||
| 115 | if(isset($depth1Value['ExtraAttribute'])){ |
||
| 116 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ExtraAttribute'] = $depth1Value['ExtraAttribute']; |
||
| 117 | } |
||
| 118 | if(isset($depth1Value['CompanyId'])){ |
||
| 119 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CompanyId'] = $depth1Value['CompanyId']; |
||
| 120 | } |
||
| 121 | if(isset($depth1Value['PriceUnit'])){ |
||
| 122 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PriceUnit'] = $depth1Value['PriceUnit']; |
||
| 123 | } |
||
| 124 | if(isset($depth1Value['Rank'])){ |
||
| 125 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.Rank'] = $depth1Value['Rank']; |
||
| 126 | } |
||
| 127 | if(isset($depth1Value['ItemBarCode'])){ |
||
| 128 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemBarCode'] = $depth1Value['ItemBarCode']; |
||
| 129 | } |
||
| 130 | if(isset($depth1Value['BePromotion'])){ |
||
| 131 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.BePromotion'] = $depth1Value['BePromotion']; |
||
| 132 | } |
||
| 133 | if(isset($depth1Value['PromotionEnd'])){ |
||
| 134 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionEnd'] = $depth1Value['PromotionEnd']; |
||
| 135 | } |
||
| 136 | if(isset($depth1Value['ItemTitle'])){ |
||
| 137 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemTitle'] = $depth1Value['ItemTitle']; |
||
| 138 | } |
||
| 139 | if(isset($depth1Value['OriginalPrice'])){ |
||
| 140 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.OriginalPrice'] = $depth1Value['OriginalPrice']; |
||
| 141 | } |
||
| 142 | if(isset($depth1Value['ItemShortTitle'])){ |
||
| 143 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemShortTitle'] = $depth1Value['ItemShortTitle']; |
||
| 144 | } |
||
| 145 | if(isset($depth1Value['CustomizeFeatureC'])){ |
||
| 146 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureC'] = $depth1Value['CustomizeFeatureC']; |
||
| 147 | } |
||
| 148 | if(isset($depth1Value['ItemQrCode'])){ |
||
| 149 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ItemQrCode'] = $depth1Value['ItemQrCode']; |
||
| 150 | } |
||
| 151 | if(isset($depth1Value['CustomizeFeatureD'])){ |
||
| 152 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureD'] = $depth1Value['CustomizeFeatureD']; |
||
| 153 | } |
||
| 154 | if(isset($depth1Value['PromotionReason'])){ |
||
| 155 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionReason'] = $depth1Value['PromotionReason']; |
||
| 156 | } |
||
| 157 | if(isset($depth1Value['CustomizeFeatureE'])){ |
||
| 158 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureE'] = $depth1Value['CustomizeFeatureE']; |
||
| 159 | } |
||
| 160 | if(isset($depth1Value['CustomizeFeatureF'])){ |
||
| 161 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureF'] = $depth1Value['CustomizeFeatureF']; |
||
| 162 | } |
||
| 163 | if(isset($depth1Value['ForestSecondId'])){ |
||
| 164 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ForestSecondId'] = $depth1Value['ForestSecondId']; |
||
| 165 | } |
||
| 166 | if(isset($depth1Value['CustomizeFeatureG'])){ |
||
| 167 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureG'] = $depth1Value['CustomizeFeatureG']; |
||
| 168 | } |
||
| 169 | if(isset($depth1Value['CustomizeFeatureH'])){ |
||
| 170 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureH'] = $depth1Value['CustomizeFeatureH']; |
||
| 171 | } |
||
| 172 | if(isset($depth1Value['CustomizeFeatureI'])){ |
||
| 173 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureI'] = $depth1Value['CustomizeFeatureI']; |
||
| 174 | } |
||
| 175 | if(isset($depth1Value['CustomizeFeatureJ'])){ |
||
| 176 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureJ'] = $depth1Value['CustomizeFeatureJ']; |
||
| 177 | } |
||
| 178 | if(isset($depth1Value['OptionGroups'])){ |
||
| 179 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.OptionGroups'] = $depth1Value['OptionGroups']; |
||
| 180 | } |
||
| 181 | if(isset($depth1Value['ModelNumber'])){ |
||
| 182 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ModelNumber'] = $depth1Value['ModelNumber']; |
||
| 183 | } |
||
| 184 | if(isset($depth1Value['SaleSpec'])){ |
||
| 185 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SaleSpec'] = $depth1Value['SaleSpec']; |
||
| 186 | } |
||
| 187 | if(isset($depth1Value['CustomizeFeatureA'])){ |
||
| 188 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureA'] = $depth1Value['CustomizeFeatureA']; |
||
| 189 | } |
||
| 190 | if(isset($depth1Value['CustomizeFeatureB'])){ |
||
| 191 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CustomizeFeatureB'] = $depth1Value['CustomizeFeatureB']; |
||
| 192 | } |
||
| 193 | if(isset($depth1Value['SuggestPrice'])){ |
||
| 194 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SuggestPrice'] = $depth1Value['SuggestPrice']; |
||
| 195 | } |
||
| 196 | if(isset($depth1Value['ForestFirstId'])){ |
||
| 197 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.ForestFirstId'] = $depth1Value['ForestFirstId']; |
||
| 198 | } |
||
| 199 | if(isset($depth1Value['CategoryName'])){ |
||
| 200 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.CategoryName'] = $depth1Value['CategoryName']; |
||
| 201 | } |
||
| 202 | if(isset($depth1Value['EnergyEfficiency'])){ |
||
| 203 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.EnergyEfficiency'] = $depth1Value['EnergyEfficiency']; |
||
| 204 | } |
||
| 205 | if(isset($depth1Value['SkuId'])){ |
||
| 206 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.SkuId'] = $depth1Value['SkuId']; |
||
| 207 | } |
||
| 208 | if(isset($depth1Value['PromotionText'])){ |
||
| 209 | $this->options['form_params']['ItemInfo.' . ($depth1 + 1) . '.PromotionText'] = $depth1Value['PromotionText']; |
||
| 210 | } |
||
| 211 | } |
||
| 212 | |||
| 213 | return $this; |
||
| 214 | } |
||
| 528 |