public function addData($data, $opType = null)
{
if (!is_array($data)) {
$data = [$data];
}
foreach ($data as $actionData) {
if ($actionData instanceof AbstractScript) {
$this->addScript($actionData, $opType);
} elseif ($actionData instanceof Document) {
$this->addDocument($actionData, $opType);
} else {
throw new \InvalidArgumentException('Data should be a Document, a Script or an array containing Documents and/or Scripts');
}
}
return $this;
}