Conditions | 10 |
Paths | 10 |
Total Lines | 56 |
Code Lines | 27 |
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 |
||
60 | public function after(Arguments $arguments) |
||
61 | { |
||
62 | $formObject = $this->getFormObject(); |
||
63 | $this->service->reset($formObject, $this->getRequest()); |
||
64 | |||
65 | if (false === $formObject->getDefinition()->hasSteps()) { |
||
66 | return; |
||
67 | } |
||
68 | |||
69 | if (!$this->getRequest()->hasArgument(PreviousLinkViewHelper::PREVIOUS_LINK_PARAMETER)) { |
||
70 | return; |
||
71 | } |
||
72 | |||
73 | $currentStep = $this->getCurrentStep(); |
||
74 | |||
75 | if ($currentStep) { |
||
76 | $stepDefinition = $this->service->getStepDefinition($currentStep); |
||
77 | |||
78 | if ($currentStep->hasSubsteps()) { |
||
79 | $stepService = FormObjectFactory::get()->getStepService($this->getFormObject()); |
||
80 | $substepsLevel = $stepService->getSubstepsLevel(); |
||
81 | |||
82 | if ($substepsLevel > 1) { |
||
83 | $substepDefinition = $currentStep->getSubsteps()->getFirstSubstepDefinition(); |
||
84 | |||
85 | while ($substepDefinition) { |
||
86 | $nextSubstepDefinition = $this->service->getNextSubstepDefinition($substepDefinition); |
||
87 | |||
88 | if (!$nextSubstepDefinition |
||
89 | || $nextSubstepDefinition->getLevel() >= $substepsLevel - 1 |
||
90 | ) { |
||
91 | break; |
||
92 | } |
||
93 | |||
94 | $substepDefinition = $nextSubstepDefinition; |
||
95 | } |
||
96 | |||
97 | $stepService->setCurrentSubstepDefinition($substepDefinition); |
||
98 | $stepService->setCurrentStep($currentStep); |
||
99 | $stepService->setSubstepsLevel($substepDefinition->getLevel()); |
||
100 | // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($substepDefinition, __CLASS__ . ':' . __LINE__ . ' $substepDefinition'); |
||
101 | // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($substepDefinition->getLevel(), __CLASS__ . ':' . __LINE__ . ' $substepDefinition->getLevel()'); |
||
102 | // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($currentStep, __CLASS__ . ':' . __LINE__ . ' $currentStep'); |
||
103 | // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($stepService, __CLASS__ . ':' . __LINE__ . ' $stepService'); |
||
104 | // die(); |
||
105 | |||
106 | return; |
||
107 | } |
||
108 | } |
||
109 | |||
110 | |||
111 | if ($stepDefinition->hasPreviousDefinition()) { |
||
112 | $this->service->redirectToStep($stepDefinition->getPreviousDefinition()->getStep(), $this->redirect()); |
||
113 | } |
||
114 | } |
||
115 | } |
||
116 | } |
||
117 |