Skip to content

Commit

Permalink
Added accessor methods
Browse files Browse the repository at this point in the history
  • Loading branch information
hamstar committed Feb 13, 2011
1 parent 0227944 commit bb8f77b
Showing 1 changed file with 67 additions and 7 deletions.
74 changes: 67 additions & 7 deletions XML/KML/Place.php
Expand Up @@ -59,47 +59,77 @@ private function cdataEscape($data)
*
* @param string $id Id of the placemark
*
* @return void
* @return XML_KML_Place this object
*/
public function setId($id)
{
$this->id = $this->sanitize($id);
return $this;
}

/**
* Returns the ID
*
* @return integer the id of this place
*/
public function getId()
{
return $this->id;
}

/**
* Sets the name escaping tags with CDATA
*
* @param string $name Name of the placemark
*
* @return void
* @return XML_KML_Place this object
*/
public function setName($name)
{
$this->name = $this->cdataEscape($name);
return $this;
}

/**
* Return the name of this place
*
* @return string the name
*/
public function getName()
{
return $this->name;
}

/**
* Sets the description escaping tags with CDATA
*
* @param string $desc Description of the placemark
*
* @return $this
* @return XML_KML_Place this object
*/
public function setDesc($desc)
{
$this->desc = $this->cdataEscape($desc);
return $this;
}

/**
* Returns the description of this place
*
* @return string the description
*/
public function getDesc()
{
return $this->desc;
}

/**
* Sets the style stripping any html and adding
* a hash sign if not present for the style
*
* @param string $style Style of the placemark
*
* @return $this
* @return XML_KML_Place this object
*/
public function setStyle($style)
{
Expand All @@ -116,13 +146,23 @@ public function setStyle($style)
return $this;
}

/**
* Returns the style of this place
*
* @return string the style
*/
public function getStyle()
{
return $this->style;
}

/**
* Sets the coordinates, checking that they are floats
*
* @param float $lat Latitude coordinate
* @param float $lng Longitude coordinate
*
* @return $this
* @return XML_KML_Place this objectz
* @throws XML_KML_Exception
*/
public function setCoords($lat, $lng)
Expand All @@ -142,12 +182,22 @@ public function setCoords($lat, $lng)
throw new XML_KML_Exception("Invalid set of coordinates.");
}

/**
* Return the coordinates of this place
*
* @return string the coordinates
*/
public function getCoords()
{
return $this->coords;
}

/**
* Sets the folder name or empty argument sets the folder to root
*
* @param string $folder Folder which the placemark goes in
*
* @return $this
* @return XML_KML_Place this object
*/
public function setFolder($folder = false)
{
Expand All @@ -157,6 +207,16 @@ public function setFolder($folder = false)
$this->folder = $folder;
}
return $this;
}
}

/**
* Return the folder which this place resides
*
* @return string the folder
*/
public function getFolder()
{
return $this->folder;
}
}
?>

0 comments on commit bb8f77b

Please sign in to comment.