Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
return (new PhpCsFixer\Config())
->setRules([
'@PER-CS' => true,
'array_syntax' => false,
'concat_space' => false,
'visibility_required' => ['elements' => ['property', 'method']], // Exclude 'const' for PHP 5.6 compatibility
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'method_argument_space' => false,
'array_indentation' => false,
'braces_position' => false,
'statement_indentation' => false,
'binary_operator_spaces' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
8 changes: 4 additions & 4 deletions Spreadsheet/Excel/Writer/BIFFwriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ protected function _setByteOrder()
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
if ($number == $teststr) {
$byte_order = 0; // Little Endian
} elseif ($number == strrev($teststr)){
} elseif ($number == strrev($teststr)) {
$byte_order = 1; // Big Endian
} else {
// Give up. I'll fix this in a later version.
return $this->raiseError("Required floating point format ".
return $this->raiseError("Required floating point format " .
"not supported on this platform.");
}
$this->_byte_order = $byte_order;
Expand All @@ -149,7 +149,7 @@ protected function _prepend($data)
if (strlen($data) > $this->_limit) {
$data = $this->_addContinue($data);
}
$this->_data = $data.$this->_data;
$this->_data = $data . $this->_data;
$this->_datasize += strlen($data);
}

Expand Down Expand Up @@ -232,7 +232,7 @@ protected function _addContinue($data)

// The first 2080/8224 bytes remain intact. However, we have to change
// the length field of the record.
$tmp = substr($data, 0, 2).pack("v", $limit-4).substr($data, 4, $limit - 4);
$tmp = substr($data, 0, 2) . pack("v", $limit - 4) . substr($data, 4, $limit - 4);

$header = pack("vv", $record, $limit); // Headers for continue records

Expand Down
92 changes: 45 additions & 47 deletions Spreadsheet/Excel/Writer/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class Spreadsheet_Excel_Writer_Format extends PEAR
* @param integer $index the XF index for the format.
* @param array $properties array with properties to be set on initialization.
*/
public function __construct($BIFF_version, $index = 0, $properties = array())
public function __construct($BIFF_version, $index = 0, $properties = [])
{
$this->_xf_index = $index;
$this->_BIFF_version = $BIFF_version;
Expand Down Expand Up @@ -314,10 +314,9 @@ public function __construct($BIFF_version, $index = 0, $properties = array())
$this->_diag_color = 0x40;

// Set properties passed to Spreadsheet_Excel_Writer_Workbook::addFormat()
foreach ($properties as $property => $value)
{
if (method_exists($this, 'set'.ucwords($property))) {
$method_name = 'set'.ucwords($property);
foreach ($properties as $property => $value) {
if (method_exists($this, 'set' . ucwords($property))) {
$method_name = 'set' . ucwords($property);
$this->$method_name($value);
}
}
Expand Down Expand Up @@ -409,8 +408,8 @@ public function getXf($style)

$header = pack("vv", $record, $length);
$data = pack("vvvvvvvv", $ifnt, $ifmt, $style, $align,
$icv, $fill,
$border1, $border2);
$icv, $fill,
$border1, $border2);
} elseif ($this->_BIFF_version == 0x0600) {
$align = $this->_text_h_align; // Alignment
$align |= $this->_text_wrap << 3;
Expand Down Expand Up @@ -497,12 +496,12 @@ public function getFont()
$header = pack("vv", $record, $length);
if ($this->_BIFF_version == 0x0500) {
$data = pack("vvvvvCCCCC", $dyHeight, $grbit, $icv, $bls,
$sss, $uls, $bFamily,
$bCharSet, $reserved, $cch);
$sss, $uls, $bFamily,
$bCharSet, $reserved, $cch);
} elseif ($this->_BIFF_version == 0x0600) {
$data = pack("vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
$sss, $uls, $bFamily,
$bCharSet, $reserved, $cch, $encoding);
$sss, $uls, $bFamily,
$bCharSet, $reserved, $cch, $encoding);
}
return ($header . $data . $this->_font_name);
}
Expand Down Expand Up @@ -549,26 +548,26 @@ public function getXfIndex()
*/
protected function _getColor($name_color = '')
{
$colors = array(
'aqua' => 0x07,
'cyan' => 0x07,
'black' => 0x00,
'blue' => 0x04,
'brown' => 0x10,
'magenta' => 0x06,
'fuchsia' => 0x06,
'gray' => 0x17,
'grey' => 0x17,
'green' => 0x11,
'lime' => 0x03,
'navy' => 0x12,
'orange' => 0x35,
'purple' => 0x14,
'red' => 0x02,
'silver' => 0x16,
'white' => 0x01,
'yellow' => 0x05,
);
$colors = [
'aqua' => 0x07,
'cyan' => 0x07,
'black' => 0x00,
'blue' => 0x04,
'brown' => 0x10,
'magenta' => 0x06,
'fuchsia' => 0x06,
'gray' => 0x17,
'grey' => 0x17,
'green' => 0x11,
'lime' => 0x03,
'navy' => 0x12,
'orange' => 0x35,
'purple' => 0x14,
'red' => 0x02,
'silver' => 0x16,
'white' => 0x01,
'yellow' => 0x05,
];

// Return the default color, 0x7FFF, if undef,
if ($name_color === '') {
Expand Down Expand Up @@ -998,35 +997,34 @@ public function setTextWrap()
*/
public function setTextRotation($angle)
{
switch ($angle)
{
switch ($angle) {
case 0:
$this->_rotation = 0;
break;
case 90:
if ($this->_BIFF_version == 0x0500) {
$this->_rotation = 3;
$this->_rotation = 3;
} elseif ($this->_BIFF_version == 0x0600) {
$this->_rotation = 180;
}
break;
case 270:
if ($this->_BIFF_version == 0x0500) {
$this->_rotation = 2;
$this->_rotation = 2;
} elseif ($this->_BIFF_version == 0x0600) {
$this->_rotation = 90;
}
break;
case -1:
if ($this->_BIFF_version == 0x0500) {
$this->_rotation = 1;
$this->_rotation = 1;
} elseif ($this->_BIFF_version == 0x0600) {
$this->_rotation = 255;
}
break;
default:
return $this->raiseError("Invalid value for angle.".
" Possible values are: 0, 90, 270 and -1 ".
return $this->raiseError("Invalid value for angle." .
" Possible values are: 0, 90, 270 and -1 " .
"for stacking top-to-bottom.");
$this->_rotation = 0;
break;
Expand Down Expand Up @@ -1087,15 +1085,15 @@ public function setScript($script)
$this->_font_script = $script;
}

/**
* Locks a cell.
*
* @access public
*/
public function setLocked()
{
$this->_locked = 1;
}
/**
* Locks a cell.
*
* @access public
*/
public function setLocked()
{
$this->_locked = 1;
}

/**
* Unlocks a cell. Useful for unprotecting particular cells of a protected sheet.
Expand Down
Loading