Validation PSR-2 : Fixes
This commit is contained in:
parent
61b5fa0beb
commit
95b3fb024a
|
@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
*
|
||||
* @return string The XF record
|
||||
*/
|
||||
function writeXf()
|
||||
public function writeXf()
|
||||
{
|
||||
// Set the type of the XF record and some of the attributes.
|
||||
if ($this->_isStyleXf) {
|
||||
|
@ -249,18 +249,14 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
|
||||
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
|
||||
//BIFF8 options: identation, shrinkToFit and text direction
|
||||
$biff8_options = $this->_style->getAlignment()->getIndent();
|
||||
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
|
||||
|
||||
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
|
||||
$data .= pack("CCC"
|
||||
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
|
||||
, $biff8_options
|
||||
, $used_attrib
|
||||
);
|
||||
$data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
|
||||
$data .= pack("VVv", $border1, $border2, $icv);
|
||||
|
||||
return($header . $data);
|
||||
|
@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setBottomColor($colorIndex)
|
||||
public function setBottomColor($colorIndex)
|
||||
{
|
||||
$this->_bottom_color = $colorIndex;
|
||||
}
|
||||
|
@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setTopColor($colorIndex)
|
||||
public function setTopColor($colorIndex)
|
||||
{
|
||||
$this->_top_color = $colorIndex;
|
||||
}
|
||||
|
@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setLeftColor($colorIndex)
|
||||
public function setLeftColor($colorIndex)
|
||||
{
|
||||
$this->_left_color = $colorIndex;
|
||||
}
|
||||
|
@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setRightColor($colorIndex)
|
||||
public function setRightColor($colorIndex)
|
||||
{
|
||||
$this->_right_color = $colorIndex;
|
||||
}
|
||||
|
@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setDiagColor($colorIndex)
|
||||
public function setDiagColor($colorIndex)
|
||||
{
|
||||
$this->_diag_color = $colorIndex;
|
||||
}
|
||||
|
@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setFgColor($colorIndex)
|
||||
public function setFgColor($colorIndex)
|
||||
{
|
||||
$this->_fg_color = $colorIndex;
|
||||
}
|
||||
|
@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param int $colorIndex Color index
|
||||
*/
|
||||
function setBgColor($colorIndex)
|
||||
public function setBgColor($colorIndex)
|
||||
{
|
||||
$this->_bg_color = $colorIndex;
|
||||
}
|
||||
|
@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @access public
|
||||
* @param integer $numberFormatIndex Index to format record
|
||||
*/
|
||||
function setNumberFormatIndex($numberFormatIndex)
|
||||
public function setNumberFormatIndex($numberFormatIndex)
|
||||
{
|
||||
$this->_numberFormatIndex = $numberFormatIndex;
|
||||
}
|
||||
|
@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @param string $borderStyle
|
||||
* @return int
|
||||
*/
|
||||
private static function _mapBorderStyle($borderStyle) {
|
||||
if (isset(self::$_mapBorderStyle[$borderStyle]))
|
||||
private static function _mapBorderStyle($borderStyle)
|
||||
{
|
||||
if (isset(self::$_mapBorderStyle[$borderStyle])) {
|
||||
return self::$_mapBorderStyle[$borderStyle];
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
|
@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @param string $fillType
|
||||
* @return int
|
||||
*/
|
||||
private static function _mapFillType($fillType) {
|
||||
if (isset(self::$_mapFillType[$fillType]))
|
||||
private static function _mapFillType($fillType)
|
||||
{
|
||||
if (isset(self::$_mapFillType[$fillType])) {
|
||||
return self::$_mapFillType[$fillType];
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
|
@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
*/
|
||||
private function _mapHAlign($hAlign)
|
||||
{
|
||||
if (isset(self::$_mapHAlign[$hAlign]))
|
||||
if (isset(self::$_mapHAlign[$hAlign])) {
|
||||
return self::$_mapHAlign[$hAlign];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -491,8 +492,9 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
* @return int
|
||||
*/
|
||||
private static function _mapVAlign($vAlign) {
|
||||
if (isset(self::$_mapVAlign[$vAlign]))
|
||||
if (isset(self::$_mapVAlign[$vAlign])) {
|
||||
return self::$_mapVAlign[$vAlign];
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -522,10 +524,14 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
*/
|
||||
private static function _mapLocked($locked) {
|
||||
switch ($locked) {
|
||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
|
||||
default: return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
|
||||
return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
|
||||
return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,11 +543,14 @@ class PHPExcel_Writer_Excel5_Xf
|
|||
*/
|
||||
private static function _mapHidden($hidden) {
|
||||
switch ($hidden) {
|
||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0;
|
||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
|
||||
default: return 0;
|
||||
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
|
||||
return 0;
|
||||
case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
|
||||
return 1;
|
||||
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -944,7 +944,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
|
||||
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
|
||||
$css['text-align'] = $textAlign;
|
||||
if (in_array($textAlign,array('left','right'))) {
|
||||
if (in_array($textAlign,array('left', 'right'))) {
|
||||
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
|
||||
}
|
||||
}
|
||||
|
@ -1265,10 +1265,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
}
|
||||
|
||||
// General horizontal alignment: Actual horizontal alignment depends on dataType
|
||||
$sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() );
|
||||
$sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex());
|
||||
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
|
||||
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align']))
|
||||
{
|
||||
&& isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) {
|
||||
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
|
||||
}
|
||||
}
|
||||
|
@ -1303,39 +1302,39 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
if ($writeCell) {
|
||||
// Column start
|
||||
$html .= ' <' . $cellType;
|
||||
if (!$this->_useInlineCss) {
|
||||
$html .= ' class="' . $cssClass . '"';
|
||||
} else {
|
||||
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
|
||||
// We must explicitly write the width of the <td> element because TCPDF
|
||||
// does not recognize e.g. <col style="width:42pt">
|
||||
$width = 0;
|
||||
$i = $colNum - 1;
|
||||
$e = $colNum + $colSpan - 1;
|
||||
while ($i++ < $e) {
|
||||
if (isset($this->_columnWidths[$sheetIndex][$i])) {
|
||||
$width += $this->_columnWidths[$sheetIndex][$i];
|
||||
}
|
||||
if (!$this->_useInlineCss) {
|
||||
$html .= ' class="' . $cssClass . '"';
|
||||
} else {
|
||||
//** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
|
||||
// We must explicitly write the width of the <td> element because TCPDF
|
||||
// does not recognize e.g. <col style="width:42pt">
|
||||
$width = 0;
|
||||
$i = $colNum - 1;
|
||||
$e = $colNum + $colSpan - 1;
|
||||
while ($i++ < $e) {
|
||||
if (isset($this->_columnWidths[$sheetIndex][$i])) {
|
||||
$width += $this->_columnWidths[$sheetIndex][$i];
|
||||
}
|
||||
$cssClass['width'] = $width . 'pt';
|
||||
}
|
||||
$cssClass['width'] = $width . 'pt';
|
||||
|
||||
// We must also explicitly write the height of the <td> element because TCPDF
|
||||
// does not recognize e.g. <tr style="height:50pt">
|
||||
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
|
||||
$height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
|
||||
$cssClass['height'] = $height;
|
||||
}
|
||||
//** end of redundant code **
|
||||
// We must also explicitly write the height of the <td> element because TCPDF
|
||||
// does not recognize e.g. <tr style="height:50pt">
|
||||
if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
|
||||
$height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
|
||||
$cssClass['height'] = $height;
|
||||
}
|
||||
//** end of redundant code **
|
||||
|
||||
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
|
||||
}
|
||||
if ($colSpan > 1) {
|
||||
$html .= ' colspan="' . $colSpan . '"';
|
||||
}
|
||||
if ($rowSpan > 1) {
|
||||
$html .= ' rowspan="' . $rowSpan . '"';
|
||||
}
|
||||
$html .= '>';
|
||||
$html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
|
||||
}
|
||||
if ($colSpan > 1) {
|
||||
$html .= ' colspan="' . $colSpan . '"';
|
||||
}
|
||||
if ($rowSpan > 1) {
|
||||
$html .= ' rowspan="' . $rowSpan . '"';
|
||||
}
|
||||
$html .= '>';
|
||||
|
||||
// Image?
|
||||
$html .= $this->_writeImageInCell($pSheet, $coordinate);
|
||||
|
@ -1510,13 +1509,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
|
||||
// loop through the individual cells in the individual merge
|
||||
$r = $fr - 1;
|
||||
while($r++ < $lr) {
|
||||
while ($r++ < $lr) {
|
||||
// also, flag this row as a HTML row that is candidate to be omitted
|
||||
$candidateSpannedRow[$r] = $r;
|
||||
|
||||
$c = $fc - 1;
|
||||
while($c++ < $lc) {
|
||||
if ( !($c == $fc && $r == $fr) ) {
|
||||
while ($c++ < $lc) {
|
||||
if (!($c == $fc && $r == $fr)) {
|
||||
// not the upper-left cell (should not be written in HTML)
|
||||
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
|
||||
'baseCell' => array($fr, $fc),
|
||||
|
@ -1546,15 +1545,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
|
|||
}
|
||||
|
||||
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
|
||||
if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
|
||||
if (isset($this->_isSpannedRow[$sheetIndex])) {
|
||||
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
|
||||
$adjustedBaseCells = array();
|
||||
$c = -1;
|
||||
$e = $countColumns - 1;
|
||||
while($c++ < $e) {
|
||||
while ($c++ < $e) {
|
||||
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
|
||||
|
||||
if ( !in_array($baseCell, $adjustedBaseCells) ) {
|
||||
if (!in_array($baseCell, $adjustedBaseCells)) {
|
||||
// subtract rowspan by 1
|
||||
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
|
||||
$adjustedBaseCells[] = $baseCell;
|
||||
|
|
|
@ -34,5 +34,4 @@ interface PHPExcel_Writer_IWriter
|
|||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function save($pFilename = null);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue