Elegant php is a php refactoring tool for Visual Studio Code, built to improve your workflowk. It give you access to a list of automated action like: Extract Method, Inline Variable, Extract Variable and more.
The actual parser of the extension work only if the opened file is a class. I'm working on an update so it can handle every type of php file.
Find Me online