Box\Spout\Writer\XLSX\Internal\Worksheet::getCellXML PHP Method

getCellXML() private method

Build and return xml for a single cell.
private getCellXML ( integer $rowIndex, integer $cellNumber, mixed $cellValue, integer $styleId ) : string
$rowIndex integer
$cellNumber integer
$cellValue mixed
$styleId integer
return string
    private function getCellXML($rowIndex, $cellNumber, $cellValue, $styleId)
    {
        $columnIndex = CellHelper::getCellIndexFromColumnIndex($cellNumber);
        $cellXML = '<c r="' . $columnIndex . $rowIndex . '"';
        $cellXML .= ' s="' . $styleId . '"';
        if (CellHelper::isNonEmptyString($cellValue)) {
            $cellXML .= $this->getCellXMLFragmentForNonEmptyString($cellValue);
        } else {
            if (CellHelper::isBoolean($cellValue)) {
                $cellXML .= ' t="b"><v>' . intval($cellValue) . '</v></c>';
            } else {
                if (CellHelper::isNumeric($cellValue)) {
                    $cellXML .= '><v>' . $cellValue . '</v></c>';
                } else {
                    if (empty($cellValue)) {
                        if ($this->styleHelper->shouldApplyStyleOnEmptyCell($styleId)) {
                            $cellXML .= '/>';
                        } else {
                            // don't write empty cells that do no need styling
                            // NOTE: not appending to $cellXML is the right behavior!!
                            $cellXML = '';
                        }
                    } else {
                        throw new InvalidArgumentException('Trying to add a value with an unsupported type: ' . gettype($cellValue));
                    }
                }
            }
        }
        return $cellXML;
    }