The purpose of this tutorial is to teach you how to refactor your code to easily rename and move files and elements without damaging your projects or severing the link between referenced items, as well as creating the necessary links between PHP elements in separate files.
The Refactoring feature allows you to:
Rename and move files and elements within those files, while maintaining the links between the items. Once an element or file has been renamed or moved, all instances of that item within the project will be automatically updated to reflect its new name / location.
Organize Includes so that elements from one file can be referenced in another file.
Refactoring should be used when you are reorganizing your project and changing names and locations of files and elements.
Note:
Refactoring will only work from within PHP Explorer view and not from Navigator view.
Renaming a file will result in the automatic renaming of all instances where that file is referenced within the project.
|
|
|
This procedure demonstrates how to Rename a file:
<?
<? require(RenFile1.php);$a = 8;? Note: Ensure you delete the PHP tags that are inserted by default when creating a new PHP file before pasting in the code.
|
The reference to RenFile1 in RenFile2 will have been updated to: require(RenFile3.php); in order to reflect the changes in the file name. |
Moving a file will result in the automatic updating of all instances where that file is referenced within the project to reflect its change of location.
|
|
|
This procedure demonstrates how to move a file:
The Preview windows will display the changes that the move will apply to your script. Note that RenFile1's new location will automatically be updated in the reference to it in RenFile2.
|
|
All PHP Elements (e.g. classes, interfaces, functions, methods) can also be renamed and refactored from within the editor window.
|
|
|
This procedure demonstrates how to use the Rename Elements feature:
|
|
|
|
|
Related Links: Organizing Includes |
|
|
©1999-2013 Zend Technologies LTD. All rights reserved.