1 package net.sourceforge.phpdt.internal.compiler.parser;
3 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
5 import org.eclipse.jface.resource.ImageDescriptor;
8 * A php variable declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
9 * @author khartlage, Matthieu Casanova
11 public class PHPVarDeclaration extends PHPSegment {
13 /** The value of the variable. */
16 * Create a php variable declaration.
17 * @param parent the parent object (it should be a php class)
18 * @param name the name of the variable
19 * @param index where the variable is in the file
20 * @param value the value
22 public PHPVarDeclaration(Object parent, String name, int index, String value) {
23 super(parent, name, index);
28 * Create a php variable declaration.
29 * @param parent the parent object (it should be a php class)
30 * @param name the name of the variable
31 * @param index where the variable is in the file
33 public PHPVarDeclaration(Object parent, String name, int index) {
34 this(parent, name, index,null);
38 * Get the image of a variable.
39 * @return the image that represents a php variable
41 public ImageDescriptor getImage() {
42 return PHPUiImages.DESC_VAR;
45 public String toString() {
46 if (value == null || value.equals("")) {
47 return super.toString();
49 return name + " = " + value;