Support for PHP - Dynamic codePHP support in Spider also includes a hint mechanism called Dynamic Code. In fact, this mechanism consists of two tools: Dynamic code takes data from PHP definition file and parses existing script code. This way, it is possible to give names and argument lists of built-in functions (and there are well over 2000 of them in total, including the ones included in the modules) and predefined and declared PHP variables and constants in the script. This makes it much more efficient to write scripts - you don't have to remember the exact names of all PHP functions, you don't have to remember the names of methods in classes, or the long list of variables. However, support for PHP begins in Spider as soon as the string string indicating the beginning of a PHP block. When you enter it, and then press Space or Enter, the code will be automatically completed with the ?> symbol (the end of the PHP block). Depending on the selected option in Program settings / Other settings / Enablers... / Dynamic PHP Hints, an extra blank line may or may not be inserted between those symbols. Dynamic codeDynamic code works by suggesting the names of usable elements (functions, class methods, variables and constants). The tool can be called in two ways:
If you have enabled automatic display, type a function name (e.g. mysql_) and wait a moment - a list of items you can use will appear. The list will highlight the first item that most closely matches the string you typed (e.g. for mysql_c this will be the name of the function mysql_connect()). If auto-hints is disabled, use Ctrl+Space to get a hint. The tool also hints method names in classes based on which objects were created. For example, if there is a class and its object: class A { function A () { // function code } } $obj = new A; Now just type (vertical line means the cursor in the document): $obj->|and use the shortcut Ctrl+Space (or wait a moment if you activated the dynamic code). A window will appear with the name of the A() method. Similarly, you can use the described mechanism when creating a class definition extending another class (inheriting from a class) using the extends keyword. The program takes into account the scope of visibility of fields and methods: class A { public function A () { // code } protected function R () { // code } } class B extends A { public function B () { // code } private function P () { // code } } $obj = new B; In the above example, the mechanism of dynamic code will also come to our aid when selecting the class from which class B should inherit (just press Ctrl+Space after typing the word extends, and a list of classes will appear), as well as when using the methods provided by both classes. As you know, the object created on the basis of class B will also handle the methods contained in class A, so in the construction hint: $obj->|method names A() and B() will be found, but the function names R () and P() will not. In the case of PHP built-in functions, the type of the variable returned by the function is displayed before the function name, e.g.: int count( ) (which means that the count() function returns an integer result). You can navigate through the list using scroll bars, arrows, etc. (as in any window). To insert the selected structure into the document, press Enter, or click on it. The icons next to the names indicate whether it is a variable, constant, or function name Dynamic hintsDynamic hints work by prompting for function arguments as the script is being written. The tool gets the data similarly to the dynamic code - from the definition file and from the script analysis results. Thanks to that you don't have to remember or search in the code which arguments are required by the function. The tool can be invoked in two ways:
Settings and other dynamic hints options In the same window, you can select the pledges of functions and variables to appear in the hints. |
Related topics |