Microweber\Utils\lib\XmlStreamer::__construct PHP Method

__construct() public method

public __construct ( $mixed, $chunkSize = 16384, $customRootNode = null, $totalBytes = null, $customChildNode = null )
$mixed Path to XML file OR file handle
$chunkSize Bytes to read per cycle (Optional, default is 16 KiB)
$customRootNode Specific root node to use (Optional)
$totalBytes Xml file size - Required if supplied file handle
    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();
    }