Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLE/PPS/Root.php
public function save($filename)
    {
        // Initial Setting for saving
        $this->bigBlockSize = pow(
            2,
            (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9
        );
        $this->smallBlockSize = pow(
            2,
            (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6
        );

        if (is_resource($filename)) {
            $this->fileHandle = $filename;
        } elseif ($filename == '-' || $filename == '') {
            if ($this->tempDirectory === null) {
                $this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
            }
            $this->tempFilename = tempnam($this->tempDirectory, 'OLE_PPS_Root');
            $this->fileHandle = fopen($this->tempFilename, 'w+b');
            if ($this->fileHandle == false) {
                throw new WriterException("Can't create temporary file.");
            }
        } else {
            $this->fileHandle = fopen($filename, 'wb');
        }
        if ($this->fileHandle == false) {
            throw new WriterException("Can't open $filename. It may be in use or protected.");
        }
        // Make an array of PPS's (for Save)
        $aList = [];
        PPS::_savePpsSetPnt($aList, [$this]);
        // calculate values for header
        list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
        // Save Header
        $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);

        // Make Small Data string (write SBD)
        $this->_data = $this->_makeSmallData($aList);

        // Write BB
        $this->_saveBigData($iSBDcnt, $aList);
        // Write PPS
        $this->_savePps($aList);
        // Write Big Block Depot and BDList and Adding Header informations
        $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);

        if (!is_resource($filename)) {
            fclose($this->fileHandle);
        }

        return true;
    }
public function save($filename)
    {
        // Initial Setting for saving
        $this->bigBlockSize = pow(
            2,
            (isset($this->bigBlockSize)) ? self::adjust2($this->bigBlockSize) : 9
        );
        $this->smallBlockSize = pow(
            2,
            (isset($this->smallBlockSize)) ? self::adjust2($this->smallBlockSize) : 6
        );

        if (is_resource($filename)) {
            $this->fileHandle = $filename;
        } elseif ($filename == '-' || $filename == '') {
            if ($this->tempDirectory === null) {
                $this->tempDirectory = \PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir();
            }
            $this->tempFilename = tempnam($this->tempDirectory, 'OLE_PPS_Root');
            $this->fileHandle = fopen($this->tempFilename, 'w+b');
            if ($this->fileHandle == false) {
                throw new WriterException("Can't create temporary file.");
            }
        } else {
            $this->fileHandle = fopen($filename, 'wb');
        }
        if ($this->fileHandle == false) {
            throw new WriterException("Can't open $filename. It may be in use or protected.");
        }
        // Make an array of PPS's (for Save)
        $aList = [];
        PPS::_savePpsSetPnt($aList, [$this]);
        // calculate values for header
        list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
        // Save Header
        $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);

        // Make Small Data string (write SBD)
        $this->_data = $this->_makeSmallData($aList);

        // Write BB
        $this->_saveBigData($iSBDcnt, $aList);
        // Write PPS
        $this->_savePps($aList);
        // Write Big Block Depot and BDList and Adding Header informations
        $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);

        if (!is_resource($filename)) {
            fclose($this->fileHandle);
        }

        return true;
    }
Method for saving the whole OLE container (including files).
In fact, if called with an empty argument (or '-'), it saves to a
temporary file and then outputs it's contents to stdout.
If a resource pointer to a stream created by fopen() is passed
it will be used, but you have to close such stream by yourself.

@param resource|string $filename the name of the file or stream where to save the OLE container

@throws WriterException

@return bool true on success