| Conditions | 11 |
| Paths | 13 |
| Total Lines | 67 |
| Code Lines | 37 |
| 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 |
||
| 31 | $orderId = $request->getSession()->get('sylius_order_id', null); |
||
| 32 | |||
| 33 | if (null === $orderId) { |
||
| 34 | $options = $configuration->getParameters()->get('after_failure'); |
||
| 35 | |||
| 36 | return $this->redirectHandler->redirectToRoute( |
||
| 37 | $configuration, |
||
| 38 | isset($options['route']) ? $options['route'] : 'sylius_shop_homepage', |
||
| 39 | isset($options['parameters']) ? $options['parameters'] : [] |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | $request->getSession()->remove('sylius_order_id'); |
||
| 44 | $order = $this->repository->find($orderId); |
||
| 45 | Assert::notNull($order); |
||
| 46 | |||
| 47 | $view = View::create() |
||
| 48 | ->setData([ |
||
| 49 | 'order' => $order |
||
| 50 | ]) |
||
| 51 | ->setTemplate($configuration->getParameters()->get('template')) |
||
| 52 | ; |
||
| 53 | |||
| 54 | return $this->viewHandler->handle($configuration, $view); |
||
| 55 | } |
||
| 56 | } |
||
| 57 |