xmlWriter = $xmlWriter; $this->style = $style; } /** * Convert twip value * * @param int|float $value * @param int|float $default * @return int|float */ protected function convertTwip($value, $default = 0) { $unit = Settings::getMeasurementUnit(); if ($unit == Settings::UNIT_TWIP || $value == $default) { return $value; } else { return $value * $unit; } } /** * Write element when ... * * @param bool $condition * @param string $element * @param string $attribute * @param string $value */ protected function writeElementIf($condition, $element, $attribute = null, $value = null) { if (!$condition) { return; } if (is_null($attribute)) { $this->xmlWriter->writeElement($element, $value); } else { $this->xmlWriter->startElement($element); $this->xmlWriter->writeAttribute($attribute, $value); $this->xmlWriter->endElement(); } } }