예제 #1
0
 public function evaluateCondition(ResourceInterface $resource = NULL)
 {
     if ($resource === NULL || !$resource instanceof SyncedCollectionInterface) {
         return $this->not ? true : false;
     }
     if ($this->not) {
         return (string) $this->token !== (string) $resource->getSyncToken();
     }
     return (string) $this->token === (string) $resource->getSyncToken();
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function generateReport(\DOMElement $el, ResourceInterface $resource, Uri $baseUri, HttpRequest $request, EventDispatcherInterface $dispatcher)
 {
     if (!$resource instanceof SyncedCollectionInterface) {
         return new HttpResponse(WebDav::CODE_UNPROCESSABLE_ENTITY);
     }
     $sync = $this->parseSyncBody($el->ownerDocument);
     // TODO: Need to support depth infinite as well.
     if ($sync->isInfinite()) {
         throw new \KoolKode\WebDav\Exception\PropfindFiniteDepthException();
     }
     // TODO: Find actual resources having changed in correct order and scope.
     $builder = new SyncResponseBuilder($resource, $baseUri, $sync->getProps(), $dispatcher);
     $builder->setSyncToken($resource->getSyncToken());
     return $builder->buildPropertiesResponse();
 }