PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-12 14:01:22 +02:00
parent 2896d62e08
commit 5bb747f8cc
7 changed files with 66 additions and 66 deletions

View File

@ -113,9 +113,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
// Convert value to number
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
);
@ -123,9 +123,9 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
// Convert value to number
$value = (float) trim(str_replace(array('$',','), '', $value));
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
return true;
}
@ -137,7 +137,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
$days = $h / 24 + $m / 1440;
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
return true;
}
@ -150,7 +150,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
// Convert value to number
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
// Set style
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
return true;
}
@ -165,7 +165,7 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
} else {
$formatCode = 'yyyy-mm-dd';
}
$cell->getWorksheet()->getStyle( $cell->getCoordinate() )
$cell->getWorksheet()->getStyle($cell->getCoordinate())
->getNumberFormat()->setFormatCode($formatCode);
return true;
}

View File

@ -191,7 +191,8 @@ class PHPExcel_Cell_DataValidation
*
* @return string
*/
public function getFormula2() {
public function getFormula2()
{
return $this->formula2;
}

View File

@ -176,9 +176,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $minor_unit
*
*/
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null,
$axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null,
$minor_unit = null)
public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
{
$this->_axis_options['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null)
@ -201,7 +199,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getAxisOptionsProperty($property) {
public function getAxisOptionsProperty($property)
{
return $this->_axis_options[$property];
}
@ -211,7 +210,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $orientation
*
*/
public function setAxisOrientation($orientation) {
public function setAxisOrientation($orientation)
{
$this->orientation = (string) $orientation;
}
@ -223,7 +223,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type
*
*/
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
}
@ -235,7 +236,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $type
*
*/
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB) {
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
}
@ -246,7 +248,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getFillProperty($property) {
public function getFillProperty($property)
{
return $this->_fill_properties[$property];
}
@ -257,7 +260,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getLineProperty($property) {
public function getLineProperty($property)
{
return $this->_line_properties[$property];
}
@ -276,10 +280,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
*/
public function setLineStyleProperties($line_width = null, $compound_type = null,
$dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null,
$head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) {
public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null) {
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width)
: null;
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
@ -304,7 +305,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleProperty($elements) {
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
}
@ -316,7 +318,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleArrowWidth($arrow) {
public function getLineStyleArrowWidth($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
}
@ -328,7 +331,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @return string
*/
public function getLineStyleArrowLength($arrow) {
public function getLineStyleArrowLength($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
}

View File

@ -31,5 +31,4 @@ interface PHPExcel_IComparable
* @return string Hash code
*/
public function getHashCode();
}

View File

@ -432,8 +432,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// FONT Index
if ($element instanceof PHPExcel_RichText_Run) {
$str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()];
}
else {
} else {
$str_fontidx = 0;
}
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
@ -573,12 +572,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
$lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
return(pack('vvvv',
$firstCellCoordinates[1] - 1,
$lastCellCoordinates[1] - 1,
PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1,
PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1
));
return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1);
}
/**
@ -632,7 +626,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($this->_outline_on) {
$this->_outline_on = 1;
}
}
}
/**
* Write a double to the specified row and column (zero indexed).
@ -907,7 +901,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Strip the '=' or '@' sign at the beginning of the formula string
if ($formula{0} == '=') {
$formula = substr($formula,1);
$formula = substr($formula, 1);
} else {
// Error handling
$this->_writeString($row, $col, 'Unrecognised character for formula');
@ -922,7 +916,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$formlen = strlen($formula); // Length of the binary string
$length = 0x16 + $formlen; // Length of the record data
$header = pack("vv", $record, $length);
$header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex)
. $num
@ -1048,7 +1042,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x34 + strlen($url);
// Pack the header data
$header = pack("vv", $record, $length);
$header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
@ -1097,7 +1091,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x24 + strlen($url);
// Pack the header data
$header = pack("vv", $record, $length);
$header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
@ -1173,15 +1167,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$dir_long = $dir_long . "\0";
// Pack the lengths of the dir strings
$dir_short_len = pack("V", strlen($dir_short) );
$dir_long_len = pack("V", strlen($dir_long) );
$stream_len = pack("V", 0);//strlen($dir_long) + 0x06);
$dir_short_len = pack("V", strlen($dir_short));
$dir_long_len = pack("V", strlen($dir_long));
$stream_len = pack("V", 0); //strlen($dir_long) + 0x06);
// Pack the undocumented parts of the hyperlink stream
$unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' );
$unknown2 = pack("H*",'0303000000000000C000000000000046' );
$unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000');
$unknown4 = pack("v", 0x03 );
$unknown1 = pack("H*", 'D0C9EA79F9BACE118C8200AA004BA90B02000000');
$unknown2 = pack("H*", '0303000000000000C000000000000046');
$unknown3 = pack("H*", 'FFFFADDE000000000000000000000000000000000000000');
$unknown4 = pack("v", 0x03);
// Pack the main data stream
$data = pack("vvvv", $row1, $row2, $col1, $col2) .
@ -1230,7 +1224,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$grbit = 0x0000; // Option flags
$ixfe = $xfIndex;
if ($height < 0 ) {
if ($height < 0) {
$height = null;
}
@ -1259,9 +1253,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$grbit |= 0x0100;
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw,
$irwMac,$reserved, $grbit, $ixfe);
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac,$reserved, $grbit, $ixfe);
$this->_append($header.$data);
}
@ -1325,7 +1318,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// FIXME !!!
$rgbHdr = 0x0040; // Row/column heading and gridline color index
$zoom_factor_page_break = ($fPageBreakPreview? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
$zoom_factor_page_break = ($fPageBreakPreview ? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
$zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal();
$data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
@ -1423,9 +1416,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$level = max(0, min($level, 7));
$grbit |= $level << 8;
$header = pack("vv", $record, $length);
$data = pack("vvvvvv", $colFirst, $colLast, $coldx,
$ixfe, $grbit, $reserved);
$header = pack("vv", $record, $length);
$data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
$this->_append($header.$data);
}
@ -1554,14 +1546,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$recordData = pack(
'vvVVVvv'
, 0x0862
, 0x0000 // unused
, 0x00000000 // unused
, 0x00000000 // unused
, 0x00000014 // size of record data
, $this->_colors[$this->_phpSheet->getTabColor()->getRGB()] // color index
, 0x0000 // unused
'vvVVVvv',
0x0862,
0x0000, // unused
0x00000000, // unused
0x00000000, // unused
0x00000014, // size of record data
$this->_colors[$this->_phpSheet->getTabColor()->getRGB()], // color index
0x0000 // unused
);
$length = strlen($recordData);

View File

@ -491,7 +491,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $vAlign
* @return int
*/
private static function _mapVAlign($vAlign) {
private static function _mapVAlign($vAlign)
{
if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign];
}
@ -504,7 +505,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation
* @return int
*/
private static function _mapTextRotation($textRotation) {
private static function _mapTextRotation($textRotation)
{
if ($textRotation >= 0) {
return $textRotation;
}
@ -522,7 +524,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapLocked($locked) {
private static function _mapLocked($locked)
{
switch ($locked) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
return 1;
@ -541,7 +544,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
private static function _mapHidden($hidden) {
private static function _mapHidden($hidden)
{
switch ($hidden) {
case PHPExcel_Style_Protection::PROTECTION_INHERIT:
return 0;

View File

@ -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';
}
}