A few more manual code style fixes for phpcs

This commit is contained in:
Adrien Crivelli 2016-12-23 00:08:55 +09:00
parent 8c66afe39a
commit af82e266c0
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
8 changed files with 58 additions and 62 deletions

View File

@ -22,12 +22,13 @@ class Color
// palette color, color index 0x08 maps to pallete index 0 // palette color, color index 0x08 maps to pallete index 0
return $palette[$color - 8]; return $palette[$color - 8];
} }
// default color table // default color table
if ($version == \PhpOffice\PhpSpreadsheet\Reader\Xls::XLS_BIFF8) { if ($version == \PhpOffice\PhpSpreadsheet\Reader\Xls::XLS_BIFF8) {
return Color\BIFF8::lookup($color); return Color\BIFF8::lookup($color);
} }
// BIFF5 // BIFF5
return Color\BIFF5::lookup($color); return Color\BIFF5::lookup($color);
return $color;
} }
} }

View File

@ -981,7 +981,6 @@ class Matrix
return $C; return $C;
} }
throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch));
break;
case 'array': case 'array':
$B = new self($args[0]); $B = new self($args[0]);
if ($this->n == $B->m) { if ($this->n == $B->m) {
@ -999,8 +998,6 @@ class Matrix
return $C; return $C;
} }
throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch)); throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(JAMAError(MatrixDimensionMismatch));
return $M;
break;
case 'integer': case 'integer':
$C = new self($this->A); $C = new self($this->A);
for ($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
@ -1010,7 +1007,6 @@ class Matrix
} }
return $C; return $C;
break;
case 'double': case 'double':
$C = new self($this->m, $this->n); $C = new self($this->m, $this->n);
for ($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
@ -1020,7 +1016,6 @@ class Matrix
} }
return $C; return $C;
break;
case 'float': case 'float':
$C = new self($this->A); $C = new self($this->A);
for ($i = 0; $i < $C->m; ++$i) { for ($i = 0; $i < $C->m; ++$i) {
@ -1030,10 +1025,8 @@ class Matrix
} }
return $C; return $C;
break;
default: default:
throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
break;
} }
} else { } else {
throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION); throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);

View File

@ -286,7 +286,7 @@ class OLE
public function _readPpsWks($blockId) public function _readPpsWks($blockId)
{ {
$fh = $this->getStream($blockId); $fh = $this->getStream($blockId);
for ($pos = 0; ; $pos += 128) { for ($pos = 0; true; $pos += 128) {
fseek($fh, $pos, SEEK_SET); fseek($fh, $pos, SEEK_SET);
$nameUtf16 = fread($fh, 64); $nameUtf16 = fread($fh, 64);
$nameLength = self::_readInt2($fh); $nameLength = self::_readInt2($fh);

View File

@ -183,7 +183,6 @@ class ZipStreamWrapper
} }
return false; return false;
break;
case SEEK_CUR: case SEEK_CUR:
if ($offset >= 0) { if ($offset >= 0) {
$this->position += $offset; $this->position += $offset;
@ -192,7 +191,6 @@ class ZipStreamWrapper
} }
return false; return false;
break;
case SEEK_END: case SEEK_END:
if (strlen($this->data) + $offset >= 0) { if (strlen($this->data) + $offset >= 0) {
$this->position = strlen($this->data) + $offset; $this->position = strlen($this->data) + $offset;
@ -201,7 +199,6 @@ class ZipStreamWrapper
} }
return false; return false;
break;
default: default:
return false; return false;
} }

View File

@ -1006,6 +1006,7 @@ class Spreadsheet
if ($pIndex > count($this->cellXfCollection) - 1) { if ($pIndex > count($this->cellXfCollection) - 1) {
throw new Exception('CellXf index is out of bounds.'); throw new Exception('CellXf index is out of bounds.');
} }
// first remove the cellXf // first remove the cellXf
array_splice($this->cellXfCollection, $pIndex, 1); array_splice($this->cellXfCollection, $pIndex, 1);

View File

@ -2349,11 +2349,13 @@ class Worksheet implements IComparable
} elseif ($pCellCoordinate == '') { } elseif ($pCellCoordinate == '') {
throw new Exception('Cell coordinate can not be zero-length string.'); throw new Exception('Cell coordinate can not be zero-length string.');
} }
// Check if we already have a comment for this cell. // Check if we already have a comment for this cell.
// If not, create a new comment.
if (isset($this->comments[$pCellCoordinate])) { if (isset($this->comments[$pCellCoordinate])) {
return $this->comments[$pCellCoordinate]; return $this->comments[$pCellCoordinate];
} }
// If not, create a new comment.
$newComment = new Comment(); $newComment = new Comment();
$this->comments[$pCellCoordinate] = $newComment; $this->comments[$pCellCoordinate] = $newComment;

View File

@ -561,7 +561,9 @@ class Parser
// Integer in the range 0..2**16-1 // Integer in the range 0..2**16-1
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) { if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
return pack('Cv', $this->ptg['ptgInt'], $num); return pack('Cv', $this->ptg['ptgInt'], $num);
} // A float }
// A float
if (BIFFwriter::getByteOrder()) { // if it's Big Endian if (BIFFwriter::getByteOrder()) { // if it's Big Endian
$num = strrev($num); $num = strrev($num);
} }