PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Writer / Xls / ConditionalHelper.php

ConditionalHelper.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xls/ConditionalHelper.php

77 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Writer\Xls;
4
5 use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
6 use PhpOffice\PhpSpreadsheet\Style\ConditionalFormatting\Wizard;
7
8 class ConditionalHelper
9 {
10 /**
11 * Formula parser.
12 *
13 * @var Parser
14 */
15 protected $parser;
16
17 /**
18 * @var mixed
19 */
20 protected $condition;
21
22 /**
23 * @var string
24 */
25 protected $cellRange;
26
27 /**
28 * @var null|string
29 */
30 protected $tokens;
31
32 /**
33 * @var int
34 */
35 protected $size;
36
37 public function __construct(Parser $parser)
38 {
39 $this->parser = $parser;
40 }
41
42 /**
43 * @param mixed $condition
44 */
45 public function processCondition($condition, string $cellRange): void
46 {
47 $this->condition = $condition;
48 $this->cellRange = $cellRange;
49
50 if (is_int($condition) || is_float($condition)) {
51 $this->size = ($condition <= 65535 ? 3 : 0x0000);
52 $this->tokens = pack('Cv', 0x1E, $condition);
53 } else {
54 try {
55 $formula = Wizard\WizardAbstract::reverseAdjustCellRef((string) $condition, $cellRange);
56 $this->parser->parse($formula);
57 $this->tokens = $this->parser->toReversePolish();
58 $this->size = strlen($this->tokens ?? '');
59 } catch (PhpSpreadsheetException $e) {
60 // In the event of a parser error with a formula value, we set the expression to ptgInt + 0
61 $this->tokens = pack('Cv', 0x1E, 0);
62 $this->size = 3;
63 }
64 }
65 }
66
67 public function tokens(): ?string
68 {
69 return $this->tokens;
70 }
71
72 public function size(): int
73 {
74 return $this->size;
75 }
76 }
77