Conditions | 3 |
Paths | 4 |
Total Lines | 52 |
Code Lines | 34 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
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 |
||
82 | public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string |
||
83 | { |
||
84 | $extensionName = $arguments['extensionName']; |
||
85 | $partial = $arguments['partial']; |
||
86 | $args = $arguments['arguments']; |
||
87 | $pluginName = $arguments['pluginName']; |
||
88 | |||
89 | // Overload arguments with own extension local settings (to pass own settings to external partial) |
||
90 | $args = self::loadSettingsIntoArguments($args, $renderingContext); |
||
91 | |||
92 | $ctxModified = false; |
||
93 | $backupExtensionName = ''; |
||
94 | $backupPluginName = ''; |
||
95 | |||
96 | if ($pluginName) { |
||
97 | $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
||
98 | $configurationManager = $objectManager->get(ConfigurationManagerInterface::class); |
||
99 | $settings = $configurationManager->getConfiguration( |
||
100 | ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, |
||
101 | str_replace('_', '', $extensionName), |
||
102 | $pluginName |
||
103 | ); |
||
104 | $args['settings'] = $settings; |
||
105 | |||
106 | $req = $renderingContext->getControllerContext()->getRequest(); |
||
|
|||
107 | |||
108 | $backupPluginName = $req->getPluginName(); |
||
109 | $backupExtensionName = $req->getControllerExtensionName(); |
||
110 | |||
111 | $req->setPluginName($pluginName); |
||
112 | $req->setControllerExtensionName(str_replace('_', '', $extensionName)); |
||
113 | |||
114 | $ctxModified = true; |
||
115 | } |
||
116 | |||
117 | $view = $renderingContext->getViewHelperVariableContainer()->getView(); |
||
118 | |||
119 | $oldPartialRootPaths = $view->getPartialRootPaths(); |
||
120 | $newPartialRootPaths = array( |
||
121 | ExtensionManagementUtility::extPath($extensionName) . 'Resources/Private/Partials' |
||
122 | ); |
||
123 | $view->setPartialRootPaths($newPartialRootPaths); |
||
124 | $content = $view->renderPartial($partial, null, $args); |
||
125 | $view->setPartialRootPaths($oldPartialRootPaths); |
||
126 | |||
127 | if ($ctxModified) { |
||
128 | $req = $renderingContext->getControllerContext()->getRequest(); |
||
129 | $req->setPluginName($backupPluginName); |
||
130 | $req->setControllerExtensionName($backupExtensionName); |
||
131 | } |
||
132 | |||
133 | return $content; |
||
134 | } |
||
152 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.