getType() public méthode

Return the object type.
public getType ( ) : string
Résultat string The object type.
Exemple #1
0
 public function testSerializeUnserializeRetainsType()
 {
     $data = $this->getMock('Horde_Kolab_Storage_Object_Writer');
     $object = new Horde_Kolab_Storage_Object();
     $headers = $this->getMock('Horde_Mime_Headers');
     $this->folder->expects($this->once())->method('getType')->will($this->returnValue('event'));
     $this->folder->expects($this->once())->method('getPath')->will($this->returnValue('INBOX/Calendar'));
     $object->setDriver($this->driver);
     $object->load('1', $this->folder, $data, $this->getMultipartMimeMessage('application/x-vnd.kolab.event'));
     $new_object = new Horde_Kolab_Storage_Object();
     $new_object->unserialize($object->serialize());
     $this->assertEquals('event', $new_object->getType());
 }
Exemple #2
0
 /**
  * Return the object data in a form that it can be stored in the backend.
  *
  * @param Horde_Kolab_Storage_Object $object The object that should receive the parsed data.
  *
  * @return string The encoded object data, ready to be written into the
  *                backend.
  */
 public function save(Horde_Kolab_Storage_Object $object)
 {
     try {
         return $this->_getParser($object->getType())->save($object->getData(), array('previous' => $object->getCurrentContent()));
     } catch (Horde_Kolab_Format_Exception $e) {
         throw new Horde_Kolab_Storage_Object_Exception(sprintf('Failed writing the Kolab object: %s', $e->getMessage()));
     }
 }