@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | $start = microtime(true); |
| 5 | 5 | $header = [ |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | $start = microtime(true); |
| 5 | 5 | $header = [ |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 3 | 3 | |
| 4 | 4 | $start = microtime(true); |
| 5 | 5 | $header = [ |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | private $urlSchemaFormat = 'http://schemas.openxmlformats.org/officeDocument/2006'; |
| 24 | 24 | |
| 25 | 25 | /** @var string */ |
| 26 | - protected $author ='Unknown Author'; |
|
| 26 | + protected $author = 'Unknown Author'; |
|
| 27 | 27 | /** @var array */ |
| 28 | 28 | protected $sheets = []; |
| 29 | 29 | /** @var array */ |
| 30 | - protected $sharedStrings = [];//unique set |
|
| 30 | + protected $sharedStrings = []; //unique set |
|
| 31 | 31 | /** @var int */ |
| 32 | - protected $shared_string_count = 0;//count of non-unique references to the unique set |
|
| 32 | + protected $shared_string_count = 0; //count of non-unique references to the unique set |
|
| 33 | 33 | /** @var array */ |
| 34 | 34 | protected $tempFiles = []; |
| 35 | 35 | /** @var array */ |
| 36 | - protected $cellFormats = [];//contains excel format like YYYY-MM-DD HH:MM:SS |
|
| 36 | + protected $cellFormats = []; //contains excel format like YYYY-MM-DD HH:MM:SS |
|
| 37 | 37 | /** @var array */ |
| 38 | - protected $cellTypes = [];//contains friendly format like datetime |
|
| 38 | + protected $cellTypes = []; //contains friendly format like datetime |
|
| 39 | 39 | /** @var string */ |
| 40 | 40 | protected $currentSheet = ''; |
| 41 | 41 | /** @var null */ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function writeToFile($filename) |
| 124 | 124 | { |
| 125 | 125 | foreach ($this->sheets as $sheetName => $sheet) { |
| 126 | - $this->finalizeSheet($sheetName);//making sure all footers have been written |
|
| 126 | + $this->finalizeSheet($sheetName); //making sure all footers have been written |
|
| 127 | 127 | } |
| 128 | 128 | if (file_exists($filename)) { |
| 129 | 129 | if (is_writable($filename)) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | $sheetFilename = $this->tempFilename(); |
| 189 | - $sheetXmlName = 'sheet' . (count($this->sheets) + 1).".xml"; |
|
| 189 | + $sheetXmlName = 'sheet'.(count($this->sheets) + 1).".xml"; |
|
| 190 | 190 | $sheetObj = new Sheet(); |
| 191 | 191 | $sheetObj |
| 192 | 192 | ->setFilename($sheetFilename) |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | $this->sheets[$sheetName] = $sheetObj; |
| 198 | 198 | /** @var Sheet $sheet */ |
| 199 | 199 | $sheet = &$this->sheets[$sheetName]; |
| 200 | - $selectedTab = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected |
|
| 201 | - $maxCell = ExcelWriter::xlsCell(self::EXCEL_MAX_ROW, self::EXCEL_MAX_COL);//XFE1048577 |
|
| 200 | + $selectedTab = count($this->sheets) == 1 ? 'true' : 'false'; //only first sheet is selected |
|
| 201 | + $maxCell = ExcelWriter::xlsCell(self::EXCEL_MAX_ROW, self::EXCEL_MAX_COL); //XFE1048577 |
|
| 202 | 202 | $sheet->getWriter()->write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"); |
| 203 | 203 | $sheet->getWriter()->write( |
| 204 | 204 | '<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $sheet = &$this->sheets[$sheetName]; |
| 406 | 406 | $columns = $sheet->getColumns(); |
| 407 | 407 | if (empty($columns)) { |
| 408 | - $sheet->setColumns(array_fill($from = 0, $until = count($row), '0'));//'0'=>'string' |
|
| 408 | + $sheet->setColumns(array_fill($from = 0, $until = count($row), '0')); //'0'=>'string' |
|
| 409 | 409 | } |
| 410 | 410 | $sheet->getWriter()->write( |
| 411 | 411 | '<row collapsed="false" customFormat="false" customHeight="false" |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $file->write('<cellXfs count="'.count($this->cellFormats).'">'); |
| 625 | 625 | foreach ($this->cellFormats as $i => $v) { |
| 626 | 626 | $file->write('<xf applyAlignment="false" applyBorder="false" applyFont="false" |
| 627 | - applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="'.(164+$i).'" xfId="0"/>'); |
|
| 627 | + applyProtection="false" borderId="0" fillId="0" fontId="0" numFmtId="'.(164 + $i).'" xfId="0"/>'); |
|
| 628 | 628 | } |
| 629 | 629 | $file->write('</cellXfs>'); |
| 630 | 630 | //$file->write( '<cellXfs count="4">'); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | $stringValue = count($this->sharedStrings); |
| 660 | 660 | $this->sharedStrings[$v] = $stringValue; |
| 661 | 661 | } |
| 662 | - $this->shared_string_count++;//non-unique count |
|
| 662 | + $this->shared_string_count++; //non-unique count |
|
| 663 | 663 | |
| 664 | 664 | return $stringValue; |
| 665 | 665 | } |
@@ -870,8 +870,8 @@ discard block |
||
| 870 | 870 | $norm = 300; |
| 871 | 871 | $range = $year - $epoch; |
| 872 | 872 | # Set month days and check for leap year. |
| 873 | - $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100)) ) ? 1 : 0; |
|
| 874 | - $mdays = array( 31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); |
|
| 873 | + $leap = (($year % 400 == 0) || (($year % 4 == 0) && ($year % 100))) ? 1 : 0; |
|
| 874 | + $mdays = array(31, ($leap ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 875 | 875 | # Some boundary checks |
| 876 | 876 | if ($year < $epoch || $year > 9999) { |
| 877 | 877 | return 0; |