Validation PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-12 12:43:52 +02:00
parent 61b5fa0beb
commit 95b3fb024a
3 changed files with 79 additions and 72 deletions

View File

@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf
* *
* @return string The XF record * @return string The XF record
*/ */
function writeXf() public function writeXf()
{ {
// Set the type of the XF record and some of the attributes. // Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) { if ($this->_isStyleXf) {
@ -256,11 +256,7 @@ class PHPExcel_Writer_Excel5_Xf
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align); $data = pack("vvvC", $ifnt, $ifmt, $style, $align);
$data .= pack("CCC" $data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
, self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
, $biff8_options
, $used_attrib
);
$data .= pack("VVv", $border1, $border2, $icv); $data .= pack("VVv", $border1, $border2, $icv);
return($header . $data); return($header . $data);
@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setBottomColor($colorIndex) public function setBottomColor($colorIndex)
{ {
$this->_bottom_color = $colorIndex; $this->_bottom_color = $colorIndex;
} }
@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setTopColor($colorIndex) public function setTopColor($colorIndex)
{ {
$this->_top_color = $colorIndex; $this->_top_color = $colorIndex;
} }
@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setLeftColor($colorIndex) public function setLeftColor($colorIndex)
{ {
$this->_left_color = $colorIndex; $this->_left_color = $colorIndex;
} }
@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setRightColor($colorIndex) public function setRightColor($colorIndex)
{ {
$this->_right_color = $colorIndex; $this->_right_color = $colorIndex;
} }
@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setDiagColor($colorIndex) public function setDiagColor($colorIndex)
{ {
$this->_diag_color = $colorIndex; $this->_diag_color = $colorIndex;
} }
@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setFgColor($colorIndex) public function setFgColor($colorIndex)
{ {
$this->_fg_color = $colorIndex; $this->_fg_color = $colorIndex;
} }
@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param int $colorIndex Color index * @param int $colorIndex Color index
*/ */
function setBgColor($colorIndex) public function setBgColor($colorIndex)
{ {
$this->_bg_color = $colorIndex; $this->_bg_color = $colorIndex;
} }
@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public * @access public
* @param integer $numberFormatIndex Index to format record * @param integer $numberFormatIndex Index to format record
*/ */
function setNumberFormatIndex($numberFormatIndex) public function setNumberFormatIndex($numberFormatIndex)
{ {
$this->_numberFormatIndex = $numberFormatIndex; $this->_numberFormatIndex = $numberFormatIndex;
} }
@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle * @param string $borderStyle
* @return int * @return int
*/ */
private static function _mapBorderStyle($borderStyle) { private static function _mapBorderStyle($borderStyle)
if (isset(self::$_mapBorderStyle[$borderStyle])) {
if (isset(self::$_mapBorderStyle[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle]; return self::$_mapBorderStyle[$borderStyle];
}
return 0x00; return 0x00;
} }
@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $fillType * @param string $fillType
* @return int * @return int
*/ */
private static function _mapFillType($fillType) { private static function _mapFillType($fillType)
if (isset(self::$_mapFillType[$fillType])) {
if (isset(self::$_mapFillType[$fillType])) {
return self::$_mapFillType[$fillType]; return self::$_mapFillType[$fillType];
}
return 0x00; return 0x00;
} }
@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
private function _mapHAlign($hAlign) private function _mapHAlign($hAlign)
{ {
if (isset(self::$_mapHAlign[$hAlign])) if (isset(self::$_mapHAlign[$hAlign])) {
return self::$_mapHAlign[$hAlign]; return self::$_mapHAlign[$hAlign];
}
return 0; return 0;
} }
@ -491,8 +492,9 @@ class PHPExcel_Writer_Excel5_Xf
* @return int * @return int
*/ */
private static function _mapVAlign($vAlign) { private static function _mapVAlign($vAlign) {
if (isset(self::$_mapVAlign[$vAlign])) if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign]; return self::$_mapVAlign[$vAlign];
}
return 2; return 2;
} }
@ -522,10 +524,14 @@ class PHPExcel_Writer_Excel5_Xf
*/ */
private static function _mapLocked($locked) { private static function _mapLocked($locked) {
switch ($locked) { switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1; case PHPExcel_Style_Protection::PROTECTION_INHERIT:
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
default: return 1; 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) { private static function _mapHidden($hidden) {
switch ($hidden) { switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0; case PHPExcel_Style_Protection::PROTECTION_INHERIT:
case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; return 0;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
default: return 0; return 1;
case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
return 0;
default:
return 0;
} }
} }
} }

View File

@ -1267,8 +1267,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// General horizontal alignment: Actual horizontal alignment depends on dataType // 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 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']; $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
} }
} }

View File

@ -34,5 +34,4 @@ interface PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function save($pFilename = null); public function save($pFilename = null);
} }