@@ -41,14 +41,14 @@ |
||
41 | 41 | public static function hashPassword($pPassword = '') |
42 | 42 | { |
43 | 43 | $password = 0x0000; |
44 | - $charPos = 1; // char position |
|
44 | + $charPos = 1; // char position |
|
45 | 45 | |
46 | 46 | // split the plain text password in its component characters |
47 | 47 | $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY); |
48 | 48 | foreach ($chars as $char) { |
49 | - $value = ord($char) << $charPos++; // shifted ASCII value |
|
50 | - $rotated_bits = $value >> 15; // rotated bits beyond bit 15 |
|
51 | - $value &= 0x7fff; // first 15 bits |
|
49 | + $value = ord($char) << $charPos++; // shifted ASCII value |
|
50 | + $rotated_bits = $value >> 15; // rotated bits beyond bit 15 |
|
51 | + $value &= 0x7fff; // first 15 bits |
|
52 | 52 | $password ^= ($value | $rotated_bits); |
53 | 53 | } |
54 | 54 |
@@ -184,7 +184,7 @@ |
||
184 | 184 | . \PhpSpreadsheet\Shared\OLE::localDateToOLE($this->Time2nd) // 116 |
185 | 185 | . pack('V', isset($this->startBlock) ? $this->startBlock : 0) // 120 |
186 | 186 | . pack('V', $this->Size) // 124 |
187 | - . pack('V', 0); // 128 |
|
187 | + . pack('V', 0); // 128 |
|
188 | 188 | return $ret; |
189 | 189 | } |
190 | 190 |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | // Initial Setting for saving |
64 | 64 | $this->_BIG_BLOCK_SIZE = pow( |
65 | 65 | 2, |
66 | - (isset($this->_BIG_BLOCK_SIZE))? self::adjust2($this->_BIG_BLOCK_SIZE) : 9 |
|
66 | + (isset($this->_BIG_BLOCK_SIZE)) ? self::adjust2($this->_BIG_BLOCK_SIZE) : 9 |
|
67 | 67 | ); |
68 | 68 | $this->_SMALL_BLOCK_SIZE = pow( |
69 | 69 | 2, |
70 | - (isset($this->_SMALL_BLOCK_SIZE))? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6 |
|
70 | + (isset($this->_SMALL_BLOCK_SIZE)) ? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6 |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | if (is_resource($filename)) { |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | $raList[$i]->Size = $raList[$i]->getDataLen(); |
131 | 131 | if ($raList[$i]->Size < \PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) { |
132 | 132 | $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
133 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
133 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
134 | 134 | } else { |
135 | 135 | $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
136 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
136 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | } |
140 | 140 | $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE; |
141 | 141 | $iSlCnt = floor($this->_BIG_BLOCK_SIZE / \PhpSpreadsheet\Shared\OLE::OLE_LONG_INT_SIZE); |
142 | - $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0); |
|
142 | + $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt) ? 1 : 0); |
|
143 | 143 | $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) + |
144 | - (($iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
144 | + (($iSmallLen % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
145 | 145 | $iCnt = count($raList); |
146 | 146 | $iBdCnt = $this->_BIG_BLOCK_SIZE / \PhpSpreadsheet\Shared\OLE::OLE_PPS_SIZE; |
147 | - $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt)? 1: 0)); |
|
147 | + $iPPScnt = (floor($iCnt / $iBdCnt) + (($iCnt % $iBdCnt) ? 1 : 0)); |
|
148 | 148 | |
149 | 149 | return [$iSBDcnt, $iBBcnt, $iPPScnt]; |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | { |
161 | 161 | $iWk = log($i2) / log(2); |
162 | 162 | |
163 | - return ($iWk > floor($iWk))? floor($iWk) + 1:$iWk; |
|
163 | + return ($iWk > floor($iWk)) ? floor($iWk) + 1 : $iWk; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -181,16 +181,16 @@ discard block |
||
181 | 181 | $iBdExL = 0; |
182 | 182 | $iAll = $iBBcnt + $iPPScnt + $iSBDcnt; |
183 | 183 | $iAllW = $iAll; |
184 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
185 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt)? 1: 0); |
|
184 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
185 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
186 | 186 | |
187 | 187 | // Calculate BD count |
188 | 188 | if ($iBdCnt > $i1stBdL) { |
189 | 189 | while (1) { |
190 | 190 | ++$iBdExL; |
191 | 191 | ++$iAllW; |
192 | - $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0); |
|
193 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt)? 1: 0); |
|
192 | + $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt) ? 1 : 0); |
|
193 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW + $iBdCntW) % $iBlCnt) ? 1 : 0); |
|
194 | 194 | if ($iBdCnt <= ($iBdExL * $iBlCnt + $i1stBdL)) { |
195 | 195 | break; |
196 | 196 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $raList[$i]->startBlock = $iStBlk; |
279 | 279 | $iStBlk += |
280 | 280 | (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) + |
281 | - (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0)); |
|
281 | + (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) ? 1 : 0)); |
|
282 | 282 | } |
283 | 283 | // Close file for each PPS, and unlink it |
284 | 284 | //if (isset($raList[$i]->_PPS_FILE)) { |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | if ($raList[$i]->Size < \PhpSpreadsheet\Shared\OLE::OLE_DATA_SIZE_SMALL) { |
312 | 312 | $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE) |
313 | - + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0); |
|
313 | + + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) ? 1 : 0); |
|
314 | 314 | // Add to SBD |
315 | 315 | $jB = $iSmbCnt - 1; |
316 | 316 | for ($j = 0; $j < $jB; ++$j) { |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | $iBdExL = 0; |
385 | 385 | $iAll = $iBsize + $iPpsCnt + $iSbdSize; |
386 | 386 | $iAllW = $iAll; |
387 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
388 | - $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt)? 1: 0); |
|
387 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
388 | + $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
389 | 389 | // Calculate BD count |
390 | 390 | if ($iBdCnt > $i1stBdL) { |
391 | 391 | while (1) { |
392 | 392 | ++$iBdExL; |
393 | 393 | ++$iAllW; |
394 | - $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0); |
|
395 | - $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt)? 1: 0); |
|
394 | + $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt) ? 1 : 0); |
|
395 | + $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW + $iBdCntW) % $iBbCnt) ? 1 : 0); |
|
396 | 396 | if ($iBdCnt <= ($iBdExL * $iBbCnt + $i1stBdL)) { |
397 | 397 | break; |
398 | 398 | } |
@@ -456,7 +456,7 @@ |
||
456 | 456 | * @var array |
457 | 457 | */ |
458 | 458 | private static $fromReplace = ['\*', '\?', '~~', '~.*', '~.?']; |
459 | - private static $toReplace = ['.*', '.', '~', '\*', '\?']; |
|
459 | + private static $toReplace = ['.*', '.', '~', '\*', '\?']; |
|
460 | 460 | |
461 | 461 | /** |
462 | 462 | * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation |
@@ -137,8 +137,7 @@ |
||
137 | 137 | $this->rotation = 0; |
138 | 138 | $this->shadow = new Drawing\Shadow(); |
139 | 139 | |
140 | - // Set image index |
|
141 | - ++self::$imageCounter; |
|
140 | + // Set image index++self::$imageCounter; |
|
142 | 141 | $this->imageIndex = self::$imageCounter; |
143 | 142 | } |
144 | 143 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | public function testGetCurrencyCode() |
66 | 66 | { |
67 | 67 | $localeconv = localeconv(); |
68 | - $expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$')); |
|
68 | + $expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol'] : '$')); |
|
69 | 69 | $result = call_user_func([StringHelper::class, 'getCurrencyCode']); |
70 | 70 | $this->assertEquals($expectedResult, $result); |
71 | 71 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | // Unix TimeStamp Result Comments |
4 | 4 | return [ |
5 | - [-2147472000, 714], // PHP 32-bit Earliest Date 14-Dec-1901 |
|
6 | - [-2082931200, 1461], // 31-Dec-1903 |
|
7 | - [-2082844800, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 |
|
8 | - [-2082758400, 1463], // 02-Jan-1904 |
|
9 | - [-285120000, 22269], // 19-Dec-1960 |
|
10 | - [0, 25569], // PHP Base Date 01-Jan-1970 |
|
11 | - [408067200, 30292], // 07-Dec-1982 |
|
12 | - [1213228800, 39611], // 12-Jun-2008 |
|
13 | - [2147472000, 50424], // PHP 32-bit Latest Date 19-Jan-2038 |
|
14 | - [-2102494934, 1234.56789], // 18-May-1903 13:37:46 |
|
15 | - [-1142494943, 12345.6789], // 18-Oct-1933 16:17:37 |
|
5 | + [-2147472000, 714], // PHP 32-bit Earliest Date 14-Dec-1901 |
|
6 | + [-2082931200, 1461], // 31-Dec-1903 |
|
7 | + [-2082844800, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 |
|
8 | + [-2082758400, 1463], // 02-Jan-1904 |
|
9 | + [-285120000, 22269], // 19-Dec-1960 |
|
10 | + [0, 25569], // PHP Base Date 01-Jan-1970 |
|
11 | + [408067200, 30292], // 07-Dec-1982 |
|
12 | + [1213228800, 39611], // 12-Jun-2008 |
|
13 | + [2147472000, 50424], // PHP 32-bit Latest Date 19-Jan-2038 |
|
14 | + [-2102494934, 1234.56789], // 18-May-1903 13:37:46 |
|
15 | + [-1142494943, 12345.6789], // 18-Oct-1933 16:17:37 |
|
16 | 16 | ]; |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | // Year Month Day Hours Minutes Seconds Result Comments |
4 | 4 | return [ |
5 | - [1901, 12, 14, 714], // PHP 32-bit Earliest Date 14-Dec-1901 |
|
6 | - [1903, 12, 31, 1461], // 31-Dec-1903 |
|
7 | - [1904, 1, 1, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 |
|
8 | - [1904, 1, 2, 1463], // 02-Jan-1904 |
|
9 | - [1960, 12, 19, 22269], // 19-Dec-1960 |
|
10 | - [1970, 1, 1, 25569], // PHP Base Date 01-Jan-1970 |
|
11 | - [1982, 12, 7, 30292], // 07-Dec-1982 |
|
12 | - [2008, 6, 12, 39611], // 12-Jun-2008 |
|
13 | - [2038, 1, 19, 50424], // PHP 32-bit Latest Date 19-Jan-2038 |
|
14 | - [1903, 5, 18, 13, 37, 46, 1234.56789], // 18-May-1903 13:37:46 |
|
15 | - [1933, 10, 18, 16, 17, 37, 12345.6789], // 18-Oct-1933 16:17:37 |
|
5 | + [1901, 12, 14, 714], // PHP 32-bit Earliest Date 14-Dec-1901 |
|
6 | + [1903, 12, 31, 1461], // 31-Dec-1903 |
|
7 | + [1904, 1, 1, 1462], // Excel 1904 Calendar Base Date 01-Jan-1904 |
|
8 | + [1904, 1, 2, 1463], // 02-Jan-1904 |
|
9 | + [1960, 12, 19, 22269], // 19-Dec-1960 |
|
10 | + [1970, 1, 1, 25569], // PHP Base Date 01-Jan-1970 |
|
11 | + [1982, 12, 7, 30292], // 07-Dec-1982 |
|
12 | + [2008, 6, 12, 39611], // 12-Jun-2008 |
|
13 | + [2038, 1, 19, 50424], // PHP 32-bit Latest Date 19-Jan-2038 |
|
14 | + [1903, 5, 18, 13, 37, 46, 1234.56789], // 18-May-1903 13:37:46 |
|
15 | + [1933, 10, 18, 16, 17, 37, 12345.6789], // 18-Oct-1933 16:17:37 |
|
16 | 16 | ]; |
@@ -2,19 +2,19 @@ |
||
2 | 2 | |
3 | 3 | // DateTime object Result Comments |
4 | 4 | return [ |
5 | - [new DateTime('1900-01-01'), 1.0], // Excel 1900 base calendar date |
|
6 | - [new DateTime('1900-02-28'), 59.0], // This and next test show gap for the mythical |
|
7 | - [new DateTime('1900-03-01'), 61.0], // MS Excel 1900 Leap Year |
|
8 | - [new DateTime('1901-12-14'), 714.0], // Unix Timestamp 32-bit Earliest Date |
|
9 | - [new DateTime('1903-12-31'), 1461.0], |
|
10 | - [new DateTime('1904-01-01'), 1462.0], // Excel 1904 Calendar Base Date |
|
11 | - [new DateTime('1904-01-02'), 1463.0], |
|
12 | - [new DateTime('1960-12-19'), 22269.0], |
|
13 | - [new DateTime('1970-01-01'), 25569.0], // Unix Timestamp Base Date |
|
14 | - [new DateTime('1982-12-07'), 30292.0], |
|
15 | - [new DateTime('2008-06-12'), 39611.0], |
|
16 | - [new DateTime('2038-01-19'), 50424.0], // Unix Timestamp 32-bit Latest Date |
|
17 | - [new DateTime('1903-05-18 13:37:46'), 1234.56789], |
|
18 | - [new DateTime('1933-10-18 16:17:37'), 12345.6789], |
|
19 | - [new DateTime('2099-12-31'), 73050.0], |
|
5 | + [new DateTime('1900-01-01'), 1.0], // Excel 1900 base calendar date |
|
6 | + [new DateTime('1900-02-28'), 59.0], // This and next test show gap for the mythical |
|
7 | + [new DateTime('1900-03-01'), 61.0], // MS Excel 1900 Leap Year |
|
8 | + [new DateTime('1901-12-14'), 714.0], // Unix Timestamp 32-bit Earliest Date |
|
9 | + [new DateTime('1903-12-31'), 1461.0], |
|
10 | + [new DateTime('1904-01-01'), 1462.0], // Excel 1904 Calendar Base Date |
|
11 | + [new DateTime('1904-01-02'), 1463.0], |
|
12 | + [new DateTime('1960-12-19'), 22269.0], |
|
13 | + [new DateTime('1970-01-01'), 25569.0], // Unix Timestamp Base Date |
|
14 | + [new DateTime('1982-12-07'), 30292.0], |
|
15 | + [new DateTime('2008-06-12'), 39611.0], |
|
16 | + [new DateTime('2038-01-19'), 50424.0], // Unix Timestamp 32-bit Latest Date |
|
17 | + [new DateTime('1903-05-18 13:37:46'), 1234.56789], |
|
18 | + [new DateTime('1933-10-18 16:17:37'), 12345.6789], |
|
19 | + [new DateTime('2099-12-31'), 73050.0], |
|
20 | 20 | ]; |