先不说什么功能,只能说这种功能对我们来说太有用了。
refactor,这种重构,其实在ZS和NETBEANS 中效果并没有现在这个软件(phpstorm)那么明显。看看它的功能就知道了。
官方网址(http://blog.jetbrains.com/webide/2011/05/extract-function-method-refactoring-for-php/)说:
We are working hard on new features for PhpStorm 2.1, and the ‘Extract Function/Method’ refactoring for PHP is one of them. This feature has been available since the first PhpStorm 2.1 EAP(106.444), and we are looking forward for your feedback.
Picture 1b: Select an expression
Invoke the refactoring from the menu ‘Refactor -> Extract Method‘ or using a hotkey. The default hotkey is Ctrl+Alt+M for Windows/Linux and Cmd+Opt+M for Mac.
Depending on the context of the selected code fragment, ‘Extract method’ (the code fragment is inside a method) (Picture 2b) or ‘Extract Function’(the code fragment is inside a function or script) (Picture 2a).
Picture 2a: ‘Extract Function’ dialog
Picture 2b: ‘Extract Method’ dialog
Enter the name of the new function/method. Press OK.
Picture 3a: The code fragment is replaced with a function call statement
Picture 3b: The expression is replaced with a method call expression
Picture 4a: Definition of the extracted function
Picture 4b: Definition of the extracted method
Develop with pleasure!
------------
看完上面的内容,你是否觉 得,原来重构也可以这样简单?