| 1 | <?php |
||
| 12 | class BatchUpdater |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var ClientInterface |
||
| 16 | */ |
||
| 17 | private $client; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var Database |
||
| 21 | */ |
||
| 22 | private $database; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | private $data; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Constructor. |
||
| 31 | * |
||
| 32 | * @param ClientInterface $client |
||
| 33 | * @param Database $db |
||
| 34 | */ |
||
| 35 | 3 | public function __construct(ClientInterface $client, Database $db) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * Enqueue the document for a update. |
||
| 45 | * |
||
| 46 | * @param array $doc |
||
| 47 | * |
||
| 48 | * @return BatchUpdater |
||
| 49 | */ |
||
| 50 | 1 | public function update(array $doc) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Enqueue a document for deletion. |
||
| 59 | * |
||
| 60 | * @param string $id |
||
| 61 | * @param string $rev |
||
| 62 | * |
||
| 63 | * @return BatchUpdater |
||
| 64 | */ |
||
| 65 | 1 | public function delete($id, $rev) |
|
| 71 | |||
| 72 | /** |
||
| 73 | * Execute the queue. |
||
| 74 | * |
||
| 75 | * @return array |
||
| 76 | */ |
||
| 77 | 2 | public function execute() |
|
| 86 | } |
||
| 87 |