import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import test.PHPVar;
/**
* A php variable declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
*/
public class PHPVarDeclaration extends PHPSegment {
- /** The value of the variable. */
- private String value;
+ /** A PHPVar. */
+ private final PHPVar variable;
/**
* Create a php variable declaration.
* @param parent the parent object (it should be a php class)
*/
public PHPVarDeclaration(Object parent, String name, int index, String value) {
super(parent, name, index);
- this.value = value;
+ variable = new PHPVar(name,value);
}
/**
return PHPUiImages.DESC_VAR;
}
+ /**
+ * Get the PHPVar
+ * @return a phpvar object
+ */
+ public PHPVar getVariable() {
+ return variable;
+ }
+
public String toString() {
- if (value == null || value.equals("")) {
- return super.toString();
- } else {
- return name + " = " + value;
- }
+ return variable.toString();
}
}