Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit c30f473

Browse files
committed
CS Fix
1 parent 1463a90 commit c30f473

File tree

8 files changed

+346
-347
lines changed

8 files changed

+346
-347
lines changed

.php_cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

33
$config = new SlamCsFixer\Config(SlamCsFixer\Config::LIB);
4-
$config->setRules([
5-
'no_unneeded_control_parentheses' => true,
6-
]);
74
$config->getFinder()
8-
->in(__DIR__ . '/lib/Pear')
5+
->in(__DIR__ . '/lib/Exception')
6+
->in(__DIR__ . '/lib/Helper')
7+
->in(__DIR__ . '/tests')
98
;
109

1110
return $config;

lib/Pear/OLE/PPS.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class PPS
9797
*
9898
* @var array
9999
*/
100-
protected $children = array();
100+
protected $children = [];
101101

102102
/**
103103
* Pointer to Excel_OLE container.

lib/Pear/OLE/PPS/File.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct($name)
3333
null,
3434
null,
3535
'',
36-
array()
36+
[]
3737
);
3838

3939
$this->_PPS_FILE = Excel\Pear\OLE::getTmpfile();

lib/Pear/OLE/PPS/Root.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function save($filename)
5858
$this->_SMALL_BLOCK_SIZE = \pow(2, ((isset($this->_SMALL_BLOCK_SIZE)) ? $this->_adjust2($this->_SMALL_BLOCK_SIZE) : 6));
5959

6060
// Make an array of PPS's (for Save)
61-
$aList = array();
62-
Excel\Pear\OLE\PPS\Root::_savePpsSetPnt($aList, array($this));
61+
$aList = [];
62+
Excel\Pear\OLE\PPS\Root::_savePpsSetPnt($aList, [$this]);
6363
// calculate values for header
6464
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); // , $rhInfo);
6565
// Save Header
@@ -115,7 +115,7 @@ private function _calcSize(& $raList)
115115
$iBdCnt = $this->_BIG_BLOCK_SIZE / Excel\Pear\OLE::Excel_OLE_PPS_SIZE;
116116
$iPPScnt = (\floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0));
117117

118-
return array($iSBDcnt, $iBBcnt, $iPPScnt);
118+
return [$iSBDcnt, $iBBcnt, $iPPScnt];
119119
}
120120

121121
/**
@@ -442,7 +442,7 @@ private function _create_header($num_sb_blocks, $num_bb_blocks, $num_pps_blocks)
442442
*/
443443
private function _calculate_big_block_chain($num_sb_blocks, $num_bb_blocks, $num_pps_blocks)
444444
{
445-
$bbd_info = array();
445+
$bbd_info = [];
446446
$bbd_info['entries_per_block'] = $this->_BIG_BLOCK_SIZE / Excel\Pear\OLE::Excel_OLE_LONG_INT_SIZE;
447447
$bbd_info['header_blockchain_list_entries'] = ($this->_BIG_BLOCK_SIZE - 0x4C) / Excel\Pear\OLE::Excel_OLE_LONG_INT_SIZE;
448448
$bbd_info['blockchain_entries'] = $num_sb_blocks + $num_bb_blocks + $num_pps_blocks;

lib/Pear/Writer/Format.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class Format
254254
* @param int $index the XF index for the format
255255
* @param array $properties array with properties to be set on initialization
256256
*/
257-
public function __construct($index = 0, $properties = array())
257+
public function __construct($index = 0, $properties = [])
258258
{
259259
$this->_xf_index = $index;
260260
$this->font_index = 0;
@@ -481,7 +481,7 @@ public function getXfIndex()
481481
*/
482482
private function _getColor($name_color = null)
483483
{
484-
$colors = array(
484+
$colors = [
485485
'aqua' => 0x07,
486486
'cyan' => 0x07,
487487
'black' => 0x00,
@@ -500,7 +500,7 @@ private function _getColor($name_color = null)
500500
'silver' => 0x16,
501501
'white' => 0x01,
502502
'yellow' => 0x05,
503-
);
503+
];
504504

505505
// Return the default color, 0x7FFF, if undef,
506506
if (null === $name_color) {
@@ -548,7 +548,7 @@ public function setHAlign($location)
548548
{
549549
$location = \strtolower((string) $location);
550550

551-
$map = array(
551+
$map = [
552552
'left' => 1,
553553
'centre' => 2,
554554
'center' => 2,
@@ -557,7 +557,7 @@ public function setHAlign($location)
557557
'justify' => 5,
558558
'merge' => 6,
559559
'equal_space' => 7,
560-
);
560+
];
561561
if (isset($map[$location])) {
562562
$this->_text_h_align = $map[$location];
563563
}
@@ -573,14 +573,14 @@ public function setVAlign($location)
573573
{
574574
$location = \strtolower((string) $location);
575575

576-
$map = array(
576+
$map = [
577577
'top' => 0,
578578
'vcentre' => 1,
579579
'vcenter' => 1,
580580
'bottom' => 2,
581581
'vjustify' => 3,
582582
'vequal_space' => 4,
583-
);
583+
];
584584
if (isset($map[$location])) {
585585
$this->_text_v_align = $map[$location];
586586
}

lib/Pear/Writer/Parser.php

+237-237
Large diffs are not rendered by default.

lib/Pear/Writer/Workbook.php

+71-71
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,18 @@ public function __construct($filename)
168168
$this->_biffsize = 0;
169169
$this->_sheetname = 'Sheet';
170170
$this->_tmp_format = new Format();
171-
$this->_worksheets = array();
172-
$this->_sheetnames = array();
173-
$this->_formats = array();
174-
$this->_palette = array();
171+
$this->_worksheets = [];
172+
$this->_sheetnames = [];
173+
$this->_formats = [];
174+
$this->_palette = [];
175175
$this->_codepage = 0x04E4; // FIXME: should change for BIFF8
176176
$this->_country_code = -1;
177177

178178
// Add the default format for hyperlinks
179-
$this->_url_format = $this->addFormat(array('color' => 'blue', 'underline' => 1));
179+
$this->_url_format = $this->addFormat(['color' => 'blue', 'underline' => 1]);
180180
$this->_str_total = 0;
181181
$this->_str_unique = 0;
182-
$this->_str_table = array();
182+
$this->_str_table = [];
183183
$this->_setPaletteXl97();
184184
}
185185

@@ -302,7 +302,7 @@ public function addWorksheet($name = '')
302302
*
303303
* @return Format reference to an Excel Format
304304
*/
305-
public function addFormat($properties = array())
305+
public function addFormat($properties = [])
306306
{
307307
$format = new Format($this->_xf_index, $properties);
308308
$this->_xf_index += 1;
@@ -345,7 +345,7 @@ public function setCustomColor($index, $red, $green, $blue)
345345
$index -= 8; // Adjust colour index (wingless dragonfly)
346346

347347
// Set the RGB value
348-
$this->_palette[$index] = array($red, $green, $blue, 0);
348+
$this->_palette[$index] = [$red, $green, $blue, 0];
349349

350350
return $index + 8;
351351
}
@@ -355,64 +355,64 @@ public function setCustomColor($index, $red, $green, $blue)
355355
*/
356356
protected function _setPaletteXl97()
357357
{
358-
$this->_palette = array(
359-
array(0x00, 0x00, 0x00, 0x00), // 8
360-
array(0xff, 0xff, 0xff, 0x00), // 9
361-
array(0xff, 0x00, 0x00, 0x00), // 10
362-
array(0x00, 0xff, 0x00, 0x00), // 11
363-
array(0x00, 0x00, 0xff, 0x00), // 12
364-
array(0xff, 0xff, 0x00, 0x00), // 13
365-
array(0xff, 0x00, 0xff, 0x00), // 14
366-
array(0x00, 0xff, 0xff, 0x00), // 15
367-
array(0x80, 0x00, 0x00, 0x00), // 16
368-
array(0x00, 0x80, 0x00, 0x00), // 17
369-
array(0x00, 0x00, 0x80, 0x00), // 18
370-
array(0x80, 0x80, 0x00, 0x00), // 19
371-
array(0x80, 0x00, 0x80, 0x00), // 20
372-
array(0x00, 0x80, 0x80, 0x00), // 21
373-
array(0xc0, 0xc0, 0xc0, 0x00), // 22
374-
array(0x80, 0x80, 0x80, 0x00), // 23
375-
array(0x99, 0x99, 0xff, 0x00), // 24
376-
array(0x99, 0x33, 0x66, 0x00), // 25
377-
array(0xff, 0xff, 0xcc, 0x00), // 26
378-
array(0xcc, 0xff, 0xff, 0x00), // 27
379-
array(0x66, 0x00, 0x66, 0x00), // 28
380-
array(0xff, 0x80, 0x80, 0x00), // 29
381-
array(0x00, 0x66, 0xcc, 0x00), // 30
382-
array(0xcc, 0xcc, 0xff, 0x00), // 31
383-
array(0x00, 0x00, 0x80, 0x00), // 32
384-
array(0xff, 0x00, 0xff, 0x00), // 33
385-
array(0xff, 0xff, 0x00, 0x00), // 34
386-
array(0x00, 0xff, 0xff, 0x00), // 35
387-
array(0x80, 0x00, 0x80, 0x00), // 36
388-
array(0x80, 0x00, 0x00, 0x00), // 37
389-
array(0x00, 0x80, 0x80, 0x00), // 38
390-
array(0x00, 0x00, 0xff, 0x00), // 39
391-
array(0x00, 0xcc, 0xff, 0x00), // 40
392-
array(0xcc, 0xff, 0xff, 0x00), // 41
393-
array(0xcc, 0xff, 0xcc, 0x00), // 42
394-
array(0xff, 0xff, 0x99, 0x00), // 43
395-
array(0x99, 0xcc, 0xff, 0x00), // 44
396-
array(0xff, 0x99, 0xcc, 0x00), // 45
397-
array(0xcc, 0x99, 0xff, 0x00), // 46
398-
array(0xff, 0xcc, 0x99, 0x00), // 47
399-
array(0x33, 0x66, 0xff, 0x00), // 48
400-
array(0x33, 0xcc, 0xcc, 0x00), // 49
401-
array(0x99, 0xcc, 0x00, 0x00), // 50
402-
array(0xff, 0xcc, 0x00, 0x00), // 51
403-
array(0xff, 0x99, 0x00, 0x00), // 52
404-
array(0xff, 0x66, 0x00, 0x00), // 53
405-
array(0x66, 0x66, 0x99, 0x00), // 54
406-
array(0x96, 0x96, 0x96, 0x00), // 55
407-
array(0x00, 0x33, 0x66, 0x00), // 56
408-
array(0x33, 0x99, 0x66, 0x00), // 57
409-
array(0x00, 0x33, 0x00, 0x00), // 58
410-
array(0x33, 0x33, 0x00, 0x00), // 59
411-
array(0x99, 0x33, 0x00, 0x00), // 60
412-
array(0x99, 0x33, 0x66, 0x00), // 61
413-
array(0x33, 0x33, 0x99, 0x00), // 62
414-
array(0x33, 0x33, 0x33, 0x00), // 63
415-
);
358+
$this->_palette = [
359+
[0x00, 0x00, 0x00, 0x00], // 8
360+
[0xff, 0xff, 0xff, 0x00], // 9
361+
[0xff, 0x00, 0x00, 0x00], // 10
362+
[0x00, 0xff, 0x00, 0x00], // 11
363+
[0x00, 0x00, 0xff, 0x00], // 12
364+
[0xff, 0xff, 0x00, 0x00], // 13
365+
[0xff, 0x00, 0xff, 0x00], // 14
366+
[0x00, 0xff, 0xff, 0x00], // 15
367+
[0x80, 0x00, 0x00, 0x00], // 16
368+
[0x00, 0x80, 0x00, 0x00], // 17
369+
[0x00, 0x00, 0x80, 0x00], // 18
370+
[0x80, 0x80, 0x00, 0x00], // 19
371+
[0x80, 0x00, 0x80, 0x00], // 20
372+
[0x00, 0x80, 0x80, 0x00], // 21
373+
[0xc0, 0xc0, 0xc0, 0x00], // 22
374+
[0x80, 0x80, 0x80, 0x00], // 23
375+
[0x99, 0x99, 0xff, 0x00], // 24
376+
[0x99, 0x33, 0x66, 0x00], // 25
377+
[0xff, 0xff, 0xcc, 0x00], // 26
378+
[0xcc, 0xff, 0xff, 0x00], // 27
379+
[0x66, 0x00, 0x66, 0x00], // 28
380+
[0xff, 0x80, 0x80, 0x00], // 29
381+
[0x00, 0x66, 0xcc, 0x00], // 30
382+
[0xcc, 0xcc, 0xff, 0x00], // 31
383+
[0x00, 0x00, 0x80, 0x00], // 32
384+
[0xff, 0x00, 0xff, 0x00], // 33
385+
[0xff, 0xff, 0x00, 0x00], // 34
386+
[0x00, 0xff, 0xff, 0x00], // 35
387+
[0x80, 0x00, 0x80, 0x00], // 36
388+
[0x80, 0x00, 0x00, 0x00], // 37
389+
[0x00, 0x80, 0x80, 0x00], // 38
390+
[0x00, 0x00, 0xff, 0x00], // 39
391+
[0x00, 0xcc, 0xff, 0x00], // 40
392+
[0xcc, 0xff, 0xff, 0x00], // 41
393+
[0xcc, 0xff, 0xcc, 0x00], // 42
394+
[0xff, 0xff, 0x99, 0x00], // 43
395+
[0x99, 0xcc, 0xff, 0x00], // 44
396+
[0xff, 0x99, 0xcc, 0x00], // 45
397+
[0xcc, 0x99, 0xff, 0x00], // 46
398+
[0xff, 0xcc, 0x99, 0x00], // 47
399+
[0x33, 0x66, 0xff, 0x00], // 48
400+
[0x33, 0xcc, 0xcc, 0x00], // 49
401+
[0x99, 0xcc, 0x00, 0x00], // 50
402+
[0xff, 0xcc, 0x00, 0x00], // 51
403+
[0xff, 0x99, 0x00, 0x00], // 52
404+
[0xff, 0x66, 0x00, 0x00], // 53
405+
[0x66, 0x66, 0x99, 0x00], // 54
406+
[0x96, 0x96, 0x96, 0x00], // 55
407+
[0x00, 0x33, 0x66, 0x00], // 56
408+
[0x33, 0x99, 0x66, 0x00], // 57
409+
[0x00, 0x33, 0x00, 0x00], // 58
410+
[0x33, 0x33, 0x00, 0x00], // 59
411+
[0x99, 0x33, 0x00, 0x00], // 60
412+
[0x99, 0x33, 0x66, 0x00], // 61
413+
[0x33, 0x33, 0x99, 0x00], // 62
414+
[0x33, 0x33, 0x33, 0x00], // 63
415+
];
416416
}
417417

418418
/**
@@ -493,7 +493,7 @@ protected function _storeExcel_OLEFile()
493493
}
494494
}
495495

496-
$root = new Excel\Pear\OLE\PPS\Root(\time(), \time(), array($Excel_OLE));
496+
$root = new Excel\Pear\OLE\PPS\Root(\time(), \time(), [$Excel_OLE]);
497497
$root->save($this->_filename);
498498

499499
return true;
@@ -541,7 +541,7 @@ protected function _storeAllFonts()
541541
// Iterate through the XF objects and write a FONT record if it isn't the
542542
// same as the default FONT and if it hasn't already been used.
543543
//
544-
$fonts = array();
544+
$fonts = [];
545545
$index = 6; // The first user defined FONT
546546

547547
$key = $format->getFontKey(); // The default font from _tmp_format
@@ -570,8 +570,8 @@ protected function _storeAllFonts()
570570
protected function _storeAllNumFormats()
571571
{
572572
// Leaning num_format syndrome
573-
$hash_num_formats = array();
574-
$num_formats = array();
573+
$hash_num_formats = [];
574+
$num_formats = [];
575575
$index = 164;
576576

577577
// Iterate through the XF objects and write a FORMAT record if it isn't a
@@ -1122,7 +1122,7 @@ protected function _calculateSharedStringsSizes()
11221122
$continue_limit = 8208;
11231123
$block_length = 0;
11241124
$written = 0;
1125-
$this->_block_sizes = array();
1125+
$this->_block_sizes = [];
11261126
$continue = 0;
11271127

11281128
foreach (\array_keys($this->_str_table) as $string) {

0 commit comments

Comments
 (0)