package net.sourceforge.phpdt.internal.compiler.parser; 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 (:. * @author khartlage, Matthieu Casanova */ public class PHPVarDeclaration extends PHPSegment { /** A PHPVar. */ private final PHPVar variable; /** * Create a php variable declaration. * @param parent the parent object (it should be a php class) * @param name the name of the variable * @param index where the variable is in the file * @param value the value */ public PHPVarDeclaration(Object parent, String name, int index, String value) { super(parent, name, index); variable = new PHPVar(name,value); } /** * Create a php variable declaration. * @param parent the parent object (it should be a php class) * @param name the name of the variable * @param index where the variable is in the file */ public PHPVarDeclaration(Object parent, String name, int index) { this(parent, name, index,null); } /** * Get the image of a variable. * @return the image that represents a php variable */ public ImageDescriptor getImage() { return PHPUiImages.DESC_VAR; } /** * Get the PHPVar. * @return a phpvar object */ public PHPVar getVariable() { return variable; } public String toString() { return variable.toString(); } }