@@ -17,19 +17,19 @@ discard block |
||
17 | 17 | private $urlSchemaFormat = 'http://schemas.openxmlformats.org/officeDocument/2006'; |
18 | 18 | |
19 | 19 | /** @var string */ |
20 | - protected $author ='Unknown Author'; |
|
20 | + protected $author = 'Unknown Author'; |
|
21 | 21 | /** @var array */ |
22 | 22 | protected $sheets = []; |
23 | 23 | /** @var array */ |
24 | - protected $sharedStrings = [];//unique set |
|
24 | + protected $sharedStrings = []; //unique set |
|
25 | 25 | /** @var int */ |
26 | - protected $shared_string_count = 0;//count of non-unique references to the unique set |
|
26 | + protected $shared_string_count = 0; //count of non-unique references to the unique set |
|
27 | 27 | /** @var array */ |
28 | 28 | protected $tempFiles = []; |
29 | 29 | /** @var array */ |
30 | - protected $cellFormats = [];//contains excel format like YYYY-MM-DD HH:MM:SS |
|
30 | + protected $cellFormats = []; //contains excel format like YYYY-MM-DD HH:MM:SS |
|
31 | 31 | /** @var array */ |
32 | - protected $cellTypes = [];//contains friendly format like datetime |
|
32 | + protected $cellTypes = []; //contains friendly format like datetime |
|
33 | 33 | /** @var string */ |
34 | 34 | protected $currentSheet = ''; |
35 | 35 | /** @var null */ |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function writeToFile($filename) |
116 | 116 | { |
117 | 117 | foreach ($this->sheets as $sheetName => $sheet) { |
118 | - self::finalizeSheet($sheetName);//making sure all footers have been written |
|
118 | + self::finalizeSheet($sheetName); //making sure all footers have been written |
|
119 | 119 | } |
120 | 120 | if (file_exists($filename)) { |
121 | 121 | if (is_writable($filename)) { |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | $zip->addFile( |
152 | 152 | $this->writeSharedStringsXML(), |
153 | 153 | "xl/sharedStrings.xml" |
154 | - ); //$zip->addFromString("xl/sharedStrings.xml", self::buildSharedStringsXML() ); |
|
154 | + ); //$zip->addFromString("xl/sharedStrings.xml", self::buildSharedStringsXML() ); |
|
155 | 155 | } |
156 | 156 | $zip->addFromString("xl/workbook.xml", self::buildWorkbookXML()); |
157 | 157 | $zip->addFile( |
158 | 158 | $this->writeStylesXML(), |
159 | 159 | "xl/styles.xml" |
160 | - ); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); |
|
160 | + ); //$zip->addFromString("xl/styles.xml" , self::buildStylesXML() ); |
|
161 | 161 | $zip->addFromString("[Content_Types].xml", self::buildContentTypesXML()); |
162 | 162 | $zip->addEmptyDir("xl/_rels/"); |
163 | 163 | $zip->addFromString("xl/_rels/workbook.xml.rels", self::buildWorkbookRelXML()); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | return; |
174 | 174 | } |
175 | 175 | $sheetFilename = $this->tempFilename(); |
176 | - $sheetXmlName = 'sheet' . (count($this->sheets) + 1).".xml"; |
|
176 | + $sheetXmlName = 'sheet'.(count($this->sheets) + 1).".xml"; |
|
177 | 177 | $sheetObj = new Sheet(); |
178 | 178 | $sheetObj |
179 | 179 | ->setFilename($sheetFilename) |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | $this->sheets[$sheetName] = $sheetObj; |
185 | 185 | /** @var Sheet $sheet */ |
186 | 186 | $sheet = &$this->sheets[$sheetName]; |
187 | - $selectedTab = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected |
|
188 | - $maxCell = ExcelWriter::xlsCell(self::EXCEL_MAX_ROW, self::EXCEL_MAX_COL);//XFE1048577 |
|
187 | + $selectedTab = count($this->sheets) == 1 ? 'true' : 'false'; //only first sheet is selected |
|
188 | + $maxCell = ExcelWriter::xlsCell(self::EXCEL_MAX_ROW, self::EXCEL_MAX_COL); //XFE1048577 |
|
189 | 189 | $sheet->getWriter()->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
190 | 190 | $sheet->getWriter()->write( |
191 | 191 | '<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $sheet = &$this->sheets[$sheetName]; |
391 | 391 | $columns = $sheet->getColumns(); |
392 | 392 | if (empty($columns)) { |
393 | - $sheet->setColumns(array_fill($from = 0, $until = count($row), '0'));//'0'=>'string' |
|
393 | + $sheet->setColumns(array_fill($from = 0, $until = count($row), '0')); //'0'=>'string' |
|
394 | 394 | } |
395 | 395 | $sheet->getWriter()->write( |
396 | 396 | '<row collapsed="false" customFormat="false" customHeight="false" |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } elseif ($cellType == 'currency' || $cellType == 'percent' || $cellType == 'numeric') { |
534 | 534 | $file->write( |
535 | 535 | '<c r="'.$cellName.'" s="'.$cellIndex.'" t="n"><v>'.self::xmlspecialchars($value).'</v></c>' |
536 | - );//int,float,currency |
|
536 | + ); //int,float,currency |
|
537 | 537 | } else { |
538 | 538 | if (!is_string($value)) { |
539 | 539 | $file->write('<c r="'.$cellName.'" s="'.$cellIndex.'" t="n"><v>'.($value * 1).'</v></c>'); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $file->write('<cellXfs count="'.count($this->cellFormats).'">'); |
610 | 610 | foreach ($this->cellFormats as $i => $v) { |
611 | 611 | $file->write('<xf applyAlignment="false" applyBorder="false" applyFont="false" |
612 | - applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="'.(164+$i).'" xfId="0"/>'); |
|
612 | + applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="'.(164 + $i).'" xfId="0"/>'); |
|
613 | 613 | } |
614 | 614 | $file->write('</cellXfs>'); |
615 | 615 | //$file->write( '<cellXfs count="4">'); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $stringValue = count($this->sharedStrings); |
645 | 645 | $this->sharedStrings[$v] = $stringValue; |
646 | 646 | } |
647 | - $this->shared_string_count++;//non-unique count |
|
647 | + $this->shared_string_count++; //non-unique count |
|
648 | 648 | |
649 | 649 | return $stringValue; |
650 | 650 | } |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | */ |
877 | 877 | public static function convertDateTime($dateInput) //thanks to Excel::Writer::XLSX::Worksheet.pm (perl) |
878 | 878 | { |
879 | - $days = 0; # Number of days since epoch |
|
880 | - $seconds = 0; # Time expressed as fraction of 24h hours in seconds |
|
879 | + $days = 0; # Number of days since epoch |
|
880 | + $seconds = 0; # Time expressed as fraction of 24h hours in seconds |
|
881 | 881 | $year = $month = $day = 0; |
882 | 882 | $hour = $min = $sec = 0; |
883 | 883 | $date_time = $dateInput; |
@@ -908,8 +908,8 @@ discard block |
||
908 | 908 | $norm = 300; |
909 | 909 | $range = $year - $epoch; |
910 | 910 | # Set month days and check for leap year. |
911 | - $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100)) ) ? 1 : 0; |
|
912 | - $mdays = array( 31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); |
|
911 | + $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100))) ? 1 : 0; |
|
912 | + $mdays = array(31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
913 | 913 | # Some boundary checks |
914 | 914 | if ($year < $epoch || $year > 9999) { |
915 | 915 | return 0; |