| Total Complexity | 7 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php namespace Nord\Lumen\Elasticsearch\Documents\Bulk; |
||
| 5 | class BulkQuery implements Arrayable |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * The number of actions to handle in one query |
||
| 10 | */ |
||
| 11 | public const BULK_SIZE_DEFAULT = 500; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var BulkAction[] |
||
| 15 | */ |
||
| 16 | private $actions = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var int |
||
| 20 | */ |
||
| 21 | private $bulkSize; |
||
| 22 | |||
| 23 | |||
| 24 | /** |
||
| 25 | * BulkQuery constructor. |
||
| 26 | * |
||
| 27 | * @param int $bulkSize |
||
| 28 | */ |
||
| 29 | public function __construct($bulkSize) |
||
| 32 | } |
||
| 33 | |||
| 34 | |||
| 35 | /** |
||
| 36 | * @param BulkAction $action |
||
| 37 | * |
||
| 38 | * @return BulkQuery |
||
| 39 | */ |
||
| 40 | public function addAction(BulkAction $action) |
||
| 41 | { |
||
| 42 | $this->actions[] = $action; |
||
| 43 | |||
| 44 | return $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * @return bool |
||
| 50 | */ |
||
| 51 | public function hasItems() |
||
| 52 | { |
||
| 53 | return !empty($this->actions); |
||
| 54 | } |
||
| 55 | |||
| 56 | |||
| 57 | /** |
||
| 58 | * @return bool whether the query is ready for dispatch |
||
| 59 | */ |
||
| 60 | public function isReady() |
||
| 63 | } |
||
| 64 | |||
| 65 | |||
| 66 | /** |
||
| 67 | * Removes all actions |
||
| 68 | */ |
||
| 69 | public function reset() |
||
| 72 | } |
||
| 73 | |||
| 74 | |||
| 75 | /** |
||
| 76 | * @inheritdoc |
||
| 77 | */ |
||
| 78 | public function toArray() |
||
| 94 |