| Conditions | 11 | 
| Paths | 28 | 
| Total Lines | 47 | 
| Code Lines | 27 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| 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  | 
            ||
| 75 | public function processWizard(Request $request, string $stage, $mode = 'install', YamlDumper $yamlDumper = null): Response  | 
            ||
| 76 |     { | 
            ||
| 77 |         if (!in_array($mode, ['install', 'upgrade'])) { | 
            ||
| 78 | $mode = 'install';  | 
            ||
| 79 | }  | 
            ||
| 80 | $session = $request->hasSession() ? $request->getSession() : null;  | 
            ||
| 81 | |||
| 82 | // begin the wizard  | 
            ||
| 83 | $wizard = new Wizard($this->stageContainer, dirname(__DIR__) . '/Resources/config/' . $mode . '_stages.yaml');  | 
            ||
| 84 | $currentStage = $wizard->getCurrentStage($stage);  | 
            ||
| 85 |         if ($currentStage instanceof WizardCompleteInterface) { | 
            ||
| 86 |             if ('upgrade' === $mode && null !== $yamlDumper) { | 
            ||
| 87 |                 $yamlDumper->setParameter('upgrading', false); | 
            ||
| 88 | }  | 
            ||
| 89 | |||
| 90 | return $currentStage->getResponse($request);  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 | $templateParams = $this->getTemplateGlobals($currentStage);  | 
            ||
| 94 | $templateParams['headertemplate'] = '@ZikulaCoreInstaller/' . $mode . 'Header.html.twig';  | 
            ||
| 95 |         if ($wizard->isHalted()) { | 
            ||
| 96 |             if (null !== $session) { | 
            ||
| 97 |                 $session->getFlashBag()->add('danger', $wizard->getWarning()); | 
            ||
| 98 | }  | 
            ||
| 99 | |||
| 100 |             return $this->renderResponse('@ZikulaCoreInstaller/error.html.twig', $templateParams); | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 | // handle the form  | 
            ||
| 104 |         if ($currentStage instanceof FormHandlerInterface) { | 
            ||
| 105 | $form = $this->formFactory->create($currentStage->getFormType(), null, $currentStage->getFormOptions());  | 
            ||
| 106 | $form->handleRequest($request);  | 
            ||
| 107 |             if ($form->isSubmitted() && $form->isValid()) { | 
            ||
| 108 | $currentStage->handleFormResult($form);  | 
            ||
| 109 | $params = [  | 
            ||
| 110 | 'stage' => $wizard->getNextStage()->getName(),  | 
            ||
| 111 | '_locale' => $this->locale  | 
            ||
| 112 | ];  | 
            ||
| 113 | |||
| 114 | $url = $this->router->generate($mode, $params);  | 
            ||
| 115 | |||
| 116 | return new RedirectResponse($url);  | 
            ||
| 117 | }  | 
            ||
| 118 | $templateParams['form'] = $form->createView();  | 
            ||
| 119 | }  | 
            ||
| 120 | |||
| 121 | return $this->renderResponse($currentStage->getTemplateName(), $templateParams);  | 
            ||
| 122 | }  | 
            ||
| 144 |