コード例 #1
0
 /**
  * @param AtomEntryAdapter $item
  * @return array
  */
 public function readCommentEntry(AtomEntryAdapter $entry)
 {
     // Get the activity entry
     $activityEntry = $entry->getExtension(ActivityNS::NS);
     $data = array();
     $published = $entry->getPublished();
     if (isset($published)) {
         // The published value of the data is only obtained from the atom:published, otherwise it is not exists
         $data['timestamp'] = toTimestamp($published->value);
     } else {
         $data['timestamp'] = '';
     }
     // process the entry
     if (isset($activityEntry->object[0])) {
         $object = $activityEntry->object[0];
         if (isset($activityEntry->object[0]->id)) {
             // Get the Object IRI
             $data['iri'] = $activityEntry->object[0]->id->value;
         } else {
             $data['iri'] = '';
         }
         $data['comment'] = $object->content->value;
         $author = $object->author[0];
         $data['name'] = @$author->name;
         $data['email'] = @$author->email;
         $data['website'] = @$author->uri;
     }
     return $data;
 }