Zend Studio (for Eclipse) supports code refactoring - it allows you to select a piece of code and extract functions / methods. For instance:

It also allows you to rename variables to further clear your code. Although this is not a fully automated solution, . , .