/**
  * @param \SimpleXMLElement $xml
  * @return array|ActivityLogsCollection
  */
 protected function buildActivityLogsFromXml(\SimpleXMLElement $xml)
 {
     $activityLogsCollection = new ActivityLogsCollection();
     if ($xml->totalCount instanceof \SimpleXMLElement) {
         $activityLogsCollection->setTotalCount((int) $xml->totalCount->__toString());
     }
     $activityLogs = $xml->xpath('activitylog');
     foreach ($activityLogs as $activityLog) {
         $activityLogsObject = new ActivityLogs();
         $activityLogsObject->__setProperty('id', (int) $activityLog->id);
         if (trim($activityLog->logtime) != '') {
             //we assume that the restAPI always return y-m-d H:i:s in the utc format
             $logTime = $this->dateTimeService->getDateTimeFromApiDateString($activityLog->logtime);
             $activityLogsObject->__setProperty('logTime', $logTime);
         }
         $activityLogsObject->__setProperty('processId', (string) $activityLog->processid);
         $activityLogsObject->__setProperty('severity', (string) $activityLog->severity);
         $activityLogsObject->__setProperty('message', (string) $activityLog->message);
         $activityLogsObject->__setProperty('additionalData', (array) $activityLog->additionaldata);
         $activityLogsObject->__setProperty('packageKey', (string) $activityLog->packagekey);
         $activityLogsObject->__setProperty('className', (string) $activityLog->classname);
         $activityLogsObject->__setProperty('methodName', (string) $activityLog->methodname);
         $activityLogsObject->__setProperty('tag', (string) $activityLog->tag);
         $activityLogsCollection[] = $activityLogsObject;
         $activityLogsObject->afterReconstitution();
     }
     return $activityLogsCollection;
 }
 /**
  * @test
  */
 public function setGet()
 {
     $this->activityLogs->__setProperty('id', '132');
     $this->activityLogs->__setProperty('logTime', '2014-01-01 10:10:00');
     $this->activityLogs->__setProperty('processId', 1233);
     $this->activityLogs->__setProperty('severity', 3);
     $this->activityLogs->__setProperty('message', 'No queue with documentId found');
     $this->activityLogs->__setProperty('additionalData', "a:0:{}");
     $this->activityLogs->__setProperty('packageKey', "packageKey");
     $this->activityLogs->__setProperty('className', "Controller_Indexer");
     $this->activityLogs->__setProperty('methodName', 'indexAction');
     $this->assertEquals('132', $this->activityLogs->getId());
     $this->assertEquals('2014-01-01 10:10:00', $this->activityLogs->getLogTime());
     $this->assertEquals(1233, $this->activityLogs->getProcessId());
     $this->assertEquals(3, $this->activityLogs->getSeverity());
     $this->assertEquals('No queue with documentId found', $this->activityLogs->getMessage());
     $this->assertEquals("a:0:{}", $this->activityLogs->getAdditionalData());
     $this->assertEquals("packageKey", $this->activityLogs->getPackageKey());
     $this->assertEquals("Controller_Indexer", $this->activityLogs->getClassName());
     $this->assertEquals('indexAction', $this->activityLogs->getMethodName());
 }