id = $id; $this->gender = $gender; } // end of member function __construct public function __toString() { print "Speaker ".$this->id.". Gender : ".$this->gender."
"; } public function getID() { return $this->id; } public function getGender() { return $this->gender; } /** * Add a segment to the speaker * @param voxilabSegment segment New segment */ public function addSegment($segment) { $this->segments[] = $segment; } /** * Encode the segment into Json * @return string */ public function toJson() { $segments = array(); foreach ($this->segments as $segment) { $segments[] = array( 'start' => $segment->getStart(), 'duration' => $segment->getDuration() ); } $array = array( 'id' => $this->id, 'gender' => $this->gender, 'segments' => $segments ); return json_encode($array); } public function getSegments() { return $this->segments; } } // end of voxilabSpeaker ?>