예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function normalize(Log $log)
 {
     if (!$log instanceof TreeLog) {
         return [];
     } elseif (null === $log->getNode()) {
         throw new Exception('The log do not contains any node and wants to be serialized?');
     }
     return array_merge(['_id' => $log->getId(), 'parent' => $log->getParentIdentifier(), 'status' => $log->getStatus()], $this->nodeNormalizer->normalize($log->getNode()));
 }
예제 #2
0
 /**
  * @Then the log should have the status :status
  */
 public function theLogShouldHaveTheStatus($status)
 {
     if ($status != $this->log->getStatus()) {
         throw new \RuntimeException(sprintf('Found status %s instead of %s', $this->log->getStatus(), $status));
     }
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function getParentIdentifier()
 {
     return null !== $this->parent ? $this->parent->getId() : null;
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function archive(Log $log)
 {
     $url = sprintf('%s/v1/archive/%s', $this->baseUrl, $log->getId());
     $response = $this->request('POST', $url);
     return $this->logNormalizer->denormalize($response);
 }