| Conditions | 1 |
| Paths | 1 |
| Total Lines | 83 |
| 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 |
||
| 27 | public function register(Container $app) |
||
| 28 | { |
||
| 29 | $app['eccube.purchase.context'] = $app->protect(function (ItemHolderInterface $origin = null) { |
||
| 30 | return new PurchaseContext($origin); |
||
| 31 | }); |
||
| 32 | |||
| 33 | $app['eccube.purchase.flow.cart.item_processors'] = function (Container $app) { |
||
| 34 | $processors = new ArrayCollection(); |
||
| 35 | $processors[] = new DisplayStatusValidator(); |
||
| 36 | $processors[] = new SaleLimitValidator(); |
||
| 37 | $processors[] = new DeliverySettingValidator($app[DeliveryRepository::class]); |
||
| 38 | $processors[] = new StockValidator(); |
||
| 39 | |||
| 40 | return $processors; |
||
| 41 | }; |
||
| 42 | |||
| 43 | $app['eccube.purchase.flow.cart.holder_processors'] = function (Container $app) { |
||
| 44 | $processors = new ArrayCollection(); |
||
| 45 | $processors[] = new PaymentProcessor($app[DeliveryRepository::class]); |
||
| 46 | $processors[] = new PaymentTotalLimitValidator($app['config']['max_total_fee']); |
||
| 47 | $processors[] = new DeliveryFeeFreeProcessor($app[BaseInfo::class]); |
||
| 48 | $processors[] = new PaymentTotalNegativeValidator(); |
||
| 49 | |||
| 50 | return $processors; |
||
| 51 | }; |
||
| 52 | |||
| 53 | $app['eccube.purchase.flow.cart'] = function (Container $app) { |
||
| 54 | $flow = new PurchaseFlow(); |
||
| 55 | $flow->setItemProcessors($app['eccube.purchase.flow.cart.item_processors']); |
||
| 56 | $flow->setItemHolderProcessors($app['eccube.purchase.flow.cart.holder_processors']); |
||
| 57 | |||
| 58 | return $flow; |
||
| 59 | }; |
||
| 60 | |||
| 61 | $app['eccube.purchase.flow.shopping.item_processors'] = function (Container $app) { |
||
| 62 | $processors = new ArrayCollection(); |
||
| 63 | $processors[] = new StockValidator(); |
||
| 64 | $processors[] = new DisplayStatusValidator(); |
||
| 65 | |||
| 66 | return $processors; |
||
| 67 | }; |
||
| 68 | |||
| 69 | $app['eccube.purchase.flow.shopping.holder_processors'] = function (Container $app) { |
||
| 70 | $processors = new ArrayCollection(); |
||
| 71 | $processors[] = new PaymentTotalLimitValidator($app['config']['max_total_fee']); |
||
| 72 | $processors[] = new DeliveryFeeProcessor($app['orm.em']); |
||
| 73 | $processors[] = new PaymentTotalNegativeValidator(); |
||
| 74 | |||
| 75 | return $processors; |
||
| 76 | }; |
||
| 77 | |||
| 78 | $app['eccube.purchase.flow.shopping'] = function (Container $app) { |
||
| 79 | $flow = new PurchaseFlow(); |
||
| 80 | $flow->setItemProcessors($app['eccube.purchase.flow.shopping.item_processors']); |
||
| 81 | $flow->setItemHolderProcessors($app['eccube.purchase.flow.shopping.holder_processors']); |
||
| 82 | |||
| 83 | return $flow; |
||
| 84 | }; |
||
| 85 | |||
| 86 | $app['eccube.purchase.flow.order.item_processors'] = function (Container $app) { |
||
| 87 | $processors = new ArrayCollection(); |
||
| 88 | $processors[] = new StockValidator(); |
||
| 89 | $processors[] = new PaymentTotalLimitValidator($app['config']['max_total_fee']); |
||
| 90 | |||
| 91 | return $processors; |
||
| 92 | }; |
||
| 93 | |||
| 94 | $app['eccube.purchase.flow.order.holder_processors'] = function (Container $app) { |
||
| 95 | $processors = new ArrayCollection(); |
||
| 96 | $processors[] = new UpdateDatePurchaseProcessor($app['config']); |
||
| 97 | $processors[] = new AdminOrderRegisterPurchaseProcessor($app); |
||
| 98 | |||
| 99 | return $processors; |
||
| 100 | }; |
||
| 101 | |||
| 102 | $app['eccube.purchase.flow.order'] = function (Container $app) { |
||
| 103 | $flow = new PurchaseFlow(); |
||
| 104 | $flow->setItemProcessors($app['eccube.purchase.flow.order.item_processors']); |
||
| 105 | $flow->setItemHolderProcessors($app['eccube.purchase.flow.order.holder_processors']); |
||
| 106 | |||
| 107 | return $flow; |
||
| 108 | }; |
||
| 109 | } |
||
| 110 | } |