/**
     * Tests InputAtomConverter->convertMessages()
     */
    public function testConvertMessages()
    {
        $xml = '<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
         xmlns:osapi="http://opensocial.org/2008/opensocialapi">
  <osapi:recipient>example.org:AD38B3886625AAF</osapi:recipient>
  <osapi:recipient>example.org:997638BAA6F25AD</osapi:recipient>
  <title>You have an invitation from Joe</title>
  <id>{msgid}</id>
  <link rel="alternate" href="http://app.example.org/invites/{msgid}"/>
  <content>Click &lt;a href="http://app.example.org/invites/{msgid}"&gt;here&lt;/a&gt; to review your invitation.</content>
</entry>';
        $message = $this->InputAtomConverter->convertMessages($xml);
        $this->assertEquals('{msgid}', $message['id']);
        $this->assertEquals('You have an invitation from Joe', $message['title']);
        $this->assertEquals('Click <a href="http://app.example.org/invites/{msgid}">here</a> to review your invitation.', $message['body']);
        $this->assertEquals('example.org:AD38B3886625AAF', $message['recipients'][0]);
        $this->assertEquals('example.org:997638BAA6F25AD', $message['recipients'][1]);
    }
 private function decodeRequests($requestParam, $requestType, $format = 'json')
 {
     if (empty($requestParam)) {
         return null;
     }
     switch ($format) {
         case 'json':
             $inputConverter = new InputJsonConverter();
             break;
         case 'atom':
             $inputConverter = new InputAtomConverter();
             break;
         default:
             throw new Exception("Invalid or unsupported input format");
             break;
     }
     switch ($requestType) {
         case 'people':
             $ret = $inputConverter->convertPeople($requestParam);
             break;
         case 'activities':
             $ret = $inputConverter->convertActivities($requestParam);
             break;
         case 'messages':
             $ret = $inputConverter->convertMessages($requestParam);
             break;
         case 'appdata':
             $ret = $inputConverter->convertAppData($requestParam);
             break;
         case 'jsonbatch':
             // this type is only used by the internal json batch format
             if ($format != 'json') {
                 throw new Exception("the json batch only supports the json input format");
             }
             $ret = $inputConverter->convertJsonBatch($requestParam);
             break;
             //TODO add 'groups' and 'messages' here
         //TODO add 'groups' and 'messages' here
         default:
             throw new Exception("Unsupported REST call");
             break;
     }
     return $ret;
 }