Apply Scrutinizer patches for indentation

This commit is contained in:
Adrien Crivelli 2016-08-25 19:35:29 +09:00
parent a85f1bdbed
commit cb0930c016
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
13 changed files with 225 additions and 191 deletions

View File

@ -253,7 +253,8 @@ class CSV extends BaseReader implements IReader
} }
$sheet = $spreadsheet->setActiveSheetIndex($this->sheetIndex); $sheet = $spreadsheet->setActiveSheetIndex($this->sheetIndex);
$escapeEnclosures = ['\\' . $this->enclosure, $escapeEnclosures = [
'\\' . $this->enclosure,
$this->enclosure . $this->enclosure, $this->enclosure . $this->enclosure,
]; ];

View File

@ -706,7 +706,8 @@ class AutoFilter
$operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) $operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
: AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
$ruleValues[] = ['operator' => $operator, $ruleValues[] = [
'operator' => $operator,
'value' => $average, 'value' => $average,
]; ];
$columnFilterTests[$columnID] = [ $columnFilterTests[$columnID] = [

View File

@ -294,8 +294,7 @@ class Excel5 extends BaseWriter implements IWriter
// set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
$reducedSpId = $countShapes[$sheetIndex]; $reducedSpId = $countShapes[$sheetIndex];
$spId = $reducedSpId $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10;
| ($sheet->getParent()->getIndex($sheet) + 1) << 10;
$spContainer->setSpId($spId); $spContainer->setSpId($spId);
// keep track of last reducedSpId // keep track of last reducedSpId
@ -352,8 +351,7 @@ class Excel5 extends BaseWriter implements IWriter
// set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
$reducedSpId = $countShapes[$sheetIndex]; $reducedSpId = $countShapes[$sheetIndex];
$spId = $reducedSpId $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10;
| ($sheet->getParent()->getIndex($sheet) + 1) << 10;
$spContainer->setSpId($spId); $spContainer->setSpId($spId);
// keep track of last reducedSpId // keep track of last reducedSpId
@ -564,50 +562,64 @@ class Excel5 extends BaseWriter implements IWriter
$dataSection_Content = ''; $dataSection_Content = '';
// GKPIDDSI_CODEPAGE: CodePage // GKPIDDSI_CODEPAGE: CodePage
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x01], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x01],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer
'data' => ['data' => 1252], ]; 'data' => ['data' => 1252],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_CATEGORY : Category // GKPIDDSI_CATEGORY : Category
if ($this->spreadsheet->getProperties()->getCategory()) { if ($this->spreadsheet->getProperties()->getCategory()) {
$dataProp = $this->spreadsheet->getProperties()->getCategory(); $dataProp = $this->spreadsheet->getProperties()->getCategory();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x02], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x02],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], 'type' => ['pack' => 'V', 'data' => 0x1E],
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// GKPIDDSI_VERSION :Version of the application that wrote the property storage // GKPIDDSI_VERSION :Version of the application that wrote the property storage
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x17], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x17],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x03], 'type' => ['pack' => 'V', 'data' => 0x03],
'data' => ['pack' => 'V', 'data' => 0x000C0000], ]; 'data' => ['pack' => 'V', 'data' => 0x000C0000],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_SCALE : FALSE // GKPIDDSI_SCALE : FALSE
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0B], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x0B],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x0B], 'type' => ['pack' => 'V', 'data' => 0x0B],
'data' => ['data' => false], ]; 'data' => ['data' => false],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application // GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x10], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x10],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x0B], 'type' => ['pack' => 'V', 'data' => 0x0B],
'data' => ['data' => false], ]; 'data' => ['data' => false],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_SHAREDOC : FALSE // GKPIDDSI_SHAREDOC : FALSE
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x13], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x13],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x0B], 'type' => ['pack' => 'V', 'data' => 0x0B],
'data' => ['data' => false], ]; 'data' => ['data' => false],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application // GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x16], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x16],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x0B], 'type' => ['pack' => 'V', 'data' => 0x0B],
'data' => ['data' => false], ]; 'data' => ['data' => false],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_DOCSPARTS // GKPIDDSI_DOCSPARTS
@ -623,10 +635,12 @@ class Excel5 extends BaseWriter implements IWriter
// value // value
$dataProp .= 'Worksheet' . chr(0); $dataProp .= 'Worksheet' . chr(0);
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0D], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x0D],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x101E], 'type' => ['pack' => 'V', 'data' => 0x101E],
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// GKPIDDSI_HEADINGPAIR // GKPIDDSI_HEADINGPAIR
@ -657,10 +671,12 @@ class Excel5 extends BaseWriter implements IWriter
$dataProp .= pack('v', 0x0000); $dataProp .= pack('v', 0x0000);
$dataProp .= pack('v', 0x0000); $dataProp .= pack('v', 0x0000);
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0C], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x0C],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x100C], 'type' => ['pack' => 'V', 'data' => 0x100C],
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// 4 Section Length // 4 Section Length
@ -760,89 +776,109 @@ class Excel5 extends BaseWriter implements IWriter
$dataSection_Content = ''; $dataSection_Content = '';
// CodePage : CP-1252 // CodePage : CP-1252
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x01], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x01],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer
'data' => ['data' => 1252], ]; 'data' => ['data' => 1252],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// Title // Title
if ($this->spreadsheet->getProperties()->getTitle()) { if ($this->spreadsheet->getProperties()->getTitle()) {
$dataProp = $this->spreadsheet->getProperties()->getTitle(); $dataProp = $this->spreadsheet->getProperties()->getTitle();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x02], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x02],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Subject // Subject
if ($this->spreadsheet->getProperties()->getSubject()) { if ($this->spreadsheet->getProperties()->getSubject()) {
$dataProp = $this->spreadsheet->getProperties()->getSubject(); $dataProp = $this->spreadsheet->getProperties()->getSubject();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x03], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x03],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Author (Creator) // Author (Creator)
if ($this->spreadsheet->getProperties()->getCreator()) { if ($this->spreadsheet->getProperties()->getCreator()) {
$dataProp = $this->spreadsheet->getProperties()->getCreator(); $dataProp = $this->spreadsheet->getProperties()->getCreator();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x04], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x04],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Keywords // Keywords
if ($this->spreadsheet->getProperties()->getKeywords()) { if ($this->spreadsheet->getProperties()->getKeywords()) {
$dataProp = $this->spreadsheet->getProperties()->getKeywords(); $dataProp = $this->spreadsheet->getProperties()->getKeywords();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x05], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x05],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Comments (Description) // Comments (Description)
if ($this->spreadsheet->getProperties()->getDescription()) { if ($this->spreadsheet->getProperties()->getDescription()) {
$dataProp = $this->spreadsheet->getProperties()->getDescription(); $dataProp = $this->spreadsheet->getProperties()->getDescription();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x06], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x06],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Last Saved By (LastModifiedBy) // Last Saved By (LastModifiedBy)
if ($this->spreadsheet->getProperties()->getLastModifiedBy()) { if ($this->spreadsheet->getProperties()->getLastModifiedBy()) {
$dataProp = $this->spreadsheet->getProperties()->getLastModifiedBy(); $dataProp = $this->spreadsheet->getProperties()->getLastModifiedBy();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x08], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x08],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length
'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Created Date/Time // Created Date/Time
if ($this->spreadsheet->getProperties()->getCreated()) { if ($this->spreadsheet->getProperties()->getCreated()) {
$dataProp = $this->spreadsheet->getProperties()->getCreated(); $dataProp = $this->spreadsheet->getProperties()->getCreated();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0C], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x0C],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], ]; 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Modified Date/Time // Modified Date/Time
if ($this->spreadsheet->getProperties()->getModified()) { if ($this->spreadsheet->getProperties()->getModified()) {
$dataProp = $this->spreadsheet->getProperties()->getModified(); $dataProp = $this->spreadsheet->getProperties()->getModified();
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0D], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x0D],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], ]; 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
} }
// Security // Security
$dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x13], $dataSection[] = [
'summary' => ['pack' => 'V', 'data' => 0x13],
'offset' => ['pack' => 'V'], 'offset' => ['pack' => 'V'],
'type' => ['pack' => 'V', 'data' => 0x03], // 4 byte signed integer 'type' => ['pack' => 'V', 'data' => 0x03], // 4 byte signed integer
'data' => ['data' => 0x00], ]; 'data' => ['data' => 0x00],
];
++$dataSection_NumProps; ++$dataSection_NumProps;
// 4 Section Length // 4 Section Length

View File

@ -1019,9 +1019,7 @@ class Worksheet extends BIFFwriter
$data = pack('vvvv', $row1, $row2, $col1, $col2); $data = pack('vvvv', $row1, $row2, $col1, $col2);
// Write the packed data // Write the packed data
$this->append($header . $data . $this->append($header . $data . $unknown1 . $options . $unknown2 . $url_len . $url);
$unknown1 . $options .
$unknown2 . $url_len . $url);
return 0; return 0;
} }
@ -1068,9 +1066,7 @@ class Worksheet extends BIFFwriter
$data = pack('vvvv', $row1, $row2, $col1, $col2); $data = pack('vvvv', $row1, $row2, $col1, $col2);
// Write the packed data // Write the packed data
$this->append($header . $data . $this->append($header . $data . $unknown1 . $options . $url_len . $url);
$unknown1 . $options .
$url_len . $url);
return 0; return 0;
} }