public function __construct($mixed, $chunkSize = 16384, $customRootNode = null, $totalBytes = null, $customChildNode = null)
{
if (is_string($mixed)) {
$this->handle = fopen($mixed, 'r');
if (isset($totalBytes)) {
$this->totalBytes = $totalBytes;
} else {
$this->totalBytes = filesize($mixed);
}
} elseif (is_resource($mixed)) {
$this->handle = $mixed;
if (!isset($totalBytes)) {
throw new \Exception('totalBytes parameter required when supplying a file handle.');
}
$this->totalBytes = $totalBytes;
}
$this->chunkSize = $chunkSize;
$this->customRootNode = $customRootNode;
$this->customChildNode = $customChildNode;
$this->init();
}