|
@@ 39-41 (lines=3) @@
|
| 36 |
|
|
| 37 |
|
public function putDocument(Path $p, $contentType, $documentData, array $ifMatch = null, array $ifNoneMatch = null) |
| 38 |
|
{ |
| 39 |
|
if (null !== $ifMatch && !in_array($this->md->getVersion($p), $ifMatch)) { |
| 40 |
|
throw new HttpException('version mismatch', 412); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
if (null !== $ifNoneMatch && in_array('*', $ifNoneMatch) && null !== $this->md->getVersion($p)) { |
| 44 |
|
throw new HttpException('document already exists', 412); |
|
@@ 43-45 (lines=3) @@
|
| 40 |
|
throw new HttpException('version mismatch', 412); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
if (null !== $ifNoneMatch && in_array('*', $ifNoneMatch) && null !== $this->md->getVersion($p)) { |
| 44 |
|
throw new HttpException('document already exists', 412); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
$updatedEntities = $this->d->putDocument($p, $documentData); |
| 48 |
|
$this->md->updateDocument($p, $contentType); |
|
@@ 56-58 (lines=3) @@
|
| 53 |
|
|
| 54 |
|
public function deleteDocument(Path $p, array $ifMatch = null) |
| 55 |
|
{ |
| 56 |
|
if (null !== $ifMatch && !in_array($this->md->getVersion($p), $ifMatch)) { |
| 57 |
|
throw new HttpException('version mismatch', 412); |
| 58 |
|
} |
| 59 |
|
$deletedEntities = $this->d->deleteDocument($p); |
| 60 |
|
foreach ($deletedEntities as $d) { |
| 61 |
|
$this->md->deleteNode(new Path($d)); |