Writer\Ods\Content: all variable names to camelcase

This commit is contained in:
Paolo Agostinetto 2017-03-04 15:02:10 +01:00
parent 8600e63123
commit e60897ae5f
1 changed files with 17 additions and 17 deletions

View File

@ -130,8 +130,8 @@ class Content extends WriterPart
{ {
$spreadsheet = $this->getParentWriter()->getSpreadsheet(); /* @var $spreadsheet Spreadsheet */ $spreadsheet = $this->getParentWriter()->getSpreadsheet(); /* @var $spreadsheet Spreadsheet */
$sheet_count = $spreadsheet->getSheetCount(); $sheetCount = $spreadsheet->getSheetCount();
for ($i = 0; $i < $sheet_count; ++$i) { for ($i = 0; $i < $sheetCount; ++$i) {
$objWriter->startElement('table:table'); $objWriter->startElement('table:table');
$objWriter->writeAttribute('table:name', $spreadsheet->getSheet($i)->getTitle()); $objWriter->writeAttribute('table:name', $spreadsheet->getSheet($i)->getTitle());
$objWriter->writeElement('office:forms'); $objWriter->writeElement('office:forms');
@ -151,11 +151,11 @@ class Content extends WriterPart
*/ */
private function writeRows(XMLWriter $objWriter, Worksheet $sheet) private function writeRows(XMLWriter $objWriter, Worksheet $sheet)
{ {
$number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX; $numberRowsRepeated = self::NUMBER_ROWS_REPEATED_MAX;
$span_row = 0; $span_row = 0;
$rows = $sheet->getRowIterator(); $rows = $sheet->getRowIterator();
while ($rows->valid()) { while ($rows->valid()) {
--$number_rows_repeated; --$numberRowsRepeated;
$row = $rows->current(); $row = $rows->current();
if ($row->getCellIterator()->valid()) { if ($row->getCellIterator()->valid()) {
if ($span_row) { if ($span_row) {
@ -189,14 +189,14 @@ class Content extends WriterPart
*/ */
private function writeCells(XMLWriter $objWriter, Worksheet\Row $row) private function writeCells(XMLWriter $objWriter, Worksheet\Row $row)
{ {
$number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX; $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX;
$prev_column = -1; $prevColumn = -1;
$cells = $row->getCellIterator(); $cells = $row->getCellIterator();
while ($cells->valid()) { while ($cells->valid()) {
$cell = $cells->current(); $cell = $cells->current();
$column = Cell::columnIndexFromString($cell->getColumn()) - 1; $column = Cell::columnIndexFromString($cell->getColumn()) - 1;
$this->writeCellSpan($objWriter, $column, $prev_column); $this->writeCellSpan($objWriter, $column, $prevColumn);
$objWriter->startElement('table:table-cell'); $objWriter->startElement('table:table-cell');
switch ($cell->getDataType()) { switch ($cell->getDataType()) {
@ -210,18 +210,18 @@ class Content extends WriterPart
break; break;
case DataType::TYPE_FORMULA: case DataType::TYPE_FORMULA:
try { try {
$formula_value = $cell->getCalculatedValue(); $formulaValue = $cell->getCalculatedValue();
} catch (\Exception $e) { } catch (\Exception $e) {
$formula_value = $cell->getValue(); $formulaValue = $cell->getValue();
} }
$objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue()); $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
if (is_numeric($formula_value)) { if (is_numeric($formulaValue)) {
$objWriter->writeAttribute('office:value-type', 'float'); $objWriter->writeAttribute('office:value-type', 'float');
} else { } else {
$objWriter->writeAttribute('office:value-type', 'string'); $objWriter->writeAttribute('office:value-type', 'string');
} }
$objWriter->writeAttribute('office:value', $formula_value); $objWriter->writeAttribute('office:value', $formulaValue);
$objWriter->writeElement('text:p', $formula_value); $objWriter->writeElement('text:p', $formulaValue);
break; break;
case DataType::TYPE_INLINE: case DataType::TYPE_INLINE:
throw new Exception('Writing of inline not implemented yet.'); throw new Exception('Writing of inline not implemented yet.');
@ -238,14 +238,14 @@ class Content extends WriterPart
} }
Comment::write($objWriter, $cell); Comment::write($objWriter, $cell);
$objWriter->endElement(); $objWriter->endElement();
$prev_column = $column; $prevColumn = $column;
$cells->next(); $cells->next();
} }
$number_cols_repeated = $number_cols_repeated - $prev_column - 1; $numberColsRepeated = $numberColsRepeated - $prevColumn - 1;
if ($number_cols_repeated > 0) { if ($numberColsRepeated > 0) {
if ($number_cols_repeated > 1) { if ($numberColsRepeated > 1) {
$objWriter->startElement('table:table-cell'); $objWriter->startElement('table:table-cell');
$objWriter->writeAttribute('table:number-columns-repeated', $number_cols_repeated); $objWriter->writeAttribute('table:number-columns-repeated', $numberColsRepeated);
$objWriter->endElement(); $objWriter->endElement();
} else { } else {
$objWriter->writeElement('table:table-cell'); $objWriter->writeElement('table:table-cell');