@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | foreach ((count($extLstXml) > 0 ? $extLstXml : [$extLstXml]) as $extLst) { |
61 | 61 | //this uri is conditionalFormattings |
62 | 62 | //https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/07d607af-5618-4ca2-b683-6a78dc0d9627 |
63 | - if (isset($extLst->ext['uri']) && (string)$extLst->ext['uri'] === '{78C0D931-6437-407d-A8EE-F0AAD7539E65}') { |
|
63 | + if (isset($extLst->ext['uri']) && (string) $extLst->ext['uri'] === '{78C0D931-6437-407d-A8EE-F0AAD7539E65}') { |
|
64 | 64 | $conditionalFormattingRuleExtensionXml = $extLst->ext; |
65 | 65 | } |
66 | 66 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | |
71 | 71 | foreach ($extFormattingsXml->children($ns['x14']) as $extFormattingXml) { |
72 | 72 | $extCfRuleXml = $extFormattingXml->cfRule; |
73 | - $extFormattingRuleObj = new self((string)$extCfRuleXml->attributes()->id); |
|
74 | - $extFormattingRuleObj->setSqref((string)$extFormattingXml->children($ns['xm'])->sqref); |
|
73 | + $extFormattingRuleObj = new self((string) $extCfRuleXml->attributes()->id); |
|
74 | + $extFormattingRuleObj->setSqref((string) $extFormattingXml->children($ns['xm'])->sqref); |
|
75 | 75 | $conditionalFormattingRuleExtensions[$extFormattingRuleObj->getId()] = $extFormattingRuleObj; |
76 | 76 | |
77 | 77 | $extDataBarObj = new ConditionalDataBarExtension(); |
@@ -91,51 +91,51 @@ discard block |
||
91 | 91 | { |
92 | 92 | $dataBarAttribute = $dataBarXml->attributes(); |
93 | 93 | if ($dataBarAttribute->minLength) { |
94 | - $extDataBarObj->setMinLength((int)$dataBarAttribute->minLength); |
|
94 | + $extDataBarObj->setMinLength((int) $dataBarAttribute->minLength); |
|
95 | 95 | } |
96 | 96 | if ($dataBarAttribute->maxLength) { |
97 | - $extDataBarObj->setMaxLength((int)$dataBarAttribute->maxLength); |
|
97 | + $extDataBarObj->setMaxLength((int) $dataBarAttribute->maxLength); |
|
98 | 98 | } |
99 | 99 | if ($dataBarAttribute->border) { |
100 | - $extDataBarObj->setBorder((bool)(string)$dataBarAttribute->border); |
|
100 | + $extDataBarObj->setBorder((bool) (string) $dataBarAttribute->border); |
|
101 | 101 | } |
102 | 102 | if ($dataBarAttribute->gradient) { |
103 | - $extDataBarObj->setGradient((bool)(string)$dataBarAttribute->gradient); |
|
103 | + $extDataBarObj->setGradient((bool) (string) $dataBarAttribute->gradient); |
|
104 | 104 | } |
105 | 105 | if ($dataBarAttribute->direction) { |
106 | - $extDataBarObj->setDirection((string)$dataBarAttribute->direction); |
|
106 | + $extDataBarObj->setDirection((string) $dataBarAttribute->direction); |
|
107 | 107 | } |
108 | 108 | if ($dataBarAttribute->negativeBarBorderColorSameAsPositive) { |
109 | - $extDataBarObj->setNegativeBarBorderColorSameAsPositive((bool)(string)$dataBarAttribute->negativeBarBorderColorSameAsPositive); |
|
109 | + $extDataBarObj->setNegativeBarBorderColorSameAsPositive((bool) (string) $dataBarAttribute->negativeBarBorderColorSameAsPositive); |
|
110 | 110 | } |
111 | 111 | if ($dataBarAttribute->axisPosition) { |
112 | - $extDataBarObj->setAxisPosition((string)$dataBarAttribute->axisPosition); |
|
112 | + $extDataBarObj->setAxisPosition((string) $dataBarAttribute->axisPosition); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | private static function parseExtDataBarElementChildrenFromXml(ConditionalDataBarExtension $extDataBarObj, SimpleXMLElement $dataBarXml, $ns): void |
117 | 117 | { |
118 | 118 | if ($dataBarXml->borderColor) { |
119 | - $extDataBarObj->setBorderColor((string)$dataBarXml->borderColor->attributes()['rgb']); |
|
119 | + $extDataBarObj->setBorderColor((string) $dataBarXml->borderColor->attributes()['rgb']); |
|
120 | 120 | } |
121 | 121 | if ($dataBarXml->negativeFillColor) { |
122 | - $extDataBarObj->setNegativeFillColor((string)$dataBarXml->negativeFillColor->attributes()['rgb']); |
|
122 | + $extDataBarObj->setNegativeFillColor((string) $dataBarXml->negativeFillColor->attributes()['rgb']); |
|
123 | 123 | } |
124 | 124 | if ($dataBarXml->negativeBorderColor) { |
125 | - $extDataBarObj->setNegativeBorderColor((string)$dataBarXml->negativeBorderColor->attributes()['rgb']); |
|
125 | + $extDataBarObj->setNegativeBorderColor((string) $dataBarXml->negativeBorderColor->attributes()['rgb']); |
|
126 | 126 | } |
127 | 127 | if ($dataBarXml->axisColor) { |
128 | 128 | $axisColorAttr = $dataBarXml->axisColor->attributes(); |
129 | - $extDataBarObj->setAxisColor((string)$axisColorAttr['rgb'], (string)$axisColorAttr['theme'], (string)$axisColorAttr['tint']); |
|
129 | + $extDataBarObj->setAxisColor((string) $axisColorAttr['rgb'], (string) $axisColorAttr['theme'], (string) $axisColorAttr['tint']); |
|
130 | 130 | } |
131 | 131 | $cfvoIndex = 0; |
132 | 132 | foreach ($dataBarXml->cfvo as $cfvo) { |
133 | - $f = (string)$cfvo->children($ns['xm'])->f; |
|
133 | + $f = (string) $cfvo->children($ns['xm'])->f; |
|
134 | 134 | if ($cfvoIndex === 0) { |
135 | - $extDataBarObj->setMinimumConditionalFormatValueObject(new ConditionalFormatValueObject((string)$cfvo->attributes()['type'], null, (empty($f) ? null : $f))); |
|
135 | + $extDataBarObj->setMinimumConditionalFormatValueObject(new ConditionalFormatValueObject((string) $cfvo->attributes()['type'], null, (empty($f) ? null : $f))); |
|
136 | 136 | } |
137 | 137 | if ($cfvoIndex === 1) { |
138 | - $extDataBarObj->setMaximumConditionalFormatValueObject(new ConditionalFormatValueObject((string)$cfvo->attributes()['type'], null, (empty($f) ? null : $f))); |
|
138 | + $extDataBarObj->setMaximumConditionalFormatValueObject(new ConditionalFormatValueObject((string) $cfvo->attributes()['type'], null, (empty($f) ? null : $f))); |
|
139 | 139 | } |
140 | 140 | $cfvoIndex++; |
141 | 141 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | foreach ($xmlSheet->conditionalFormatting as $conditional) { |
41 | 41 | foreach ($conditional->cfRule as $cfRule) { |
42 | 42 | if ( |
43 | - ((string)$cfRule['type'] == Conditional::CONDITION_NONE |
|
44 | - || (string)$cfRule['type'] == Conditional::CONDITION_CELLIS |
|
45 | - || (string)$cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT |
|
46 | - || (string)$cfRule['type'] == Conditional::CONDITION_CONTAINSBLANKS |
|
47 | - || (string)$cfRule['type'] == Conditional::CONDITION_NOTCONTAINSBLANKS |
|
48 | - || (string)$cfRule['type'] == Conditional::CONDITION_EXPRESSION) |
|
49 | - && isset($this->dxfs[(int)($cfRule['dxfId'])]) |
|
43 | + ((string) $cfRule['type'] == Conditional::CONDITION_NONE |
|
44 | + || (string) $cfRule['type'] == Conditional::CONDITION_CELLIS |
|
45 | + || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSTEXT |
|
46 | + || (string) $cfRule['type'] == Conditional::CONDITION_CONTAINSBLANKS |
|
47 | + || (string) $cfRule['type'] == Conditional::CONDITION_NOTCONTAINSBLANKS |
|
48 | + || (string) $cfRule['type'] == Conditional::CONDITION_EXPRESSION) |
|
49 | + && isset($this->dxfs[(int) ($cfRule['dxfId'])]) |
|
50 | 50 | ) { |
51 | - $conditionals[(string)$conditional['sqref']][(int)($cfRule['priority'])] = $cfRule; |
|
52 | - } elseif ((string)$cfRule['type'] == Conditional::CONDITION_DATABAR) { |
|
53 | - $conditionals[(string)$conditional['sqref']][(int)($cfRule['priority'])] = $cfRule; |
|
51 | + $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; |
|
52 | + } elseif ((string) $cfRule['type'] == Conditional::CONDITION_DATABAR) { |
|
53 | + $conditionals[(string) $conditional['sqref']][(int) ($cfRule['priority'])] = $cfRule; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -78,29 +78,29 @@ discard block |
||
78 | 78 | $conditionalStyles = []; |
79 | 79 | foreach ($cfRules as $cfRule) { |
80 | 80 | $objConditional = new Conditional(); |
81 | - $objConditional->setConditionType((string)$cfRule['type']); |
|
82 | - $objConditional->setOperatorType((string)$cfRule['operator']); |
|
81 | + $objConditional->setConditionType((string) $cfRule['type']); |
|
82 | + $objConditional->setOperatorType((string) $cfRule['operator']); |
|
83 | 83 | |
84 | - if ((string)$cfRule['text'] != '') { |
|
85 | - $objConditional->setText((string)$cfRule['text']); |
|
84 | + if ((string) $cfRule['text'] != '') { |
|
85 | + $objConditional->setText((string) $cfRule['text']); |
|
86 | 86 | } |
87 | 87 | |
88 | - if (isset($cfRule['stopIfTrue']) && (int)$cfRule['stopIfTrue'] === 1) { |
|
88 | + if (isset($cfRule['stopIfTrue']) && (int) $cfRule['stopIfTrue'] === 1) { |
|
89 | 89 | $objConditional->setStopIfTrue(true); |
90 | 90 | } |
91 | 91 | |
92 | 92 | if (count($cfRule->formula) > 1) { |
93 | 93 | foreach ($cfRule->formula as $formula) { |
94 | - $objConditional->addCondition((string)$formula); |
|
94 | + $objConditional->addCondition((string) $formula); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | - $objConditional->addCondition((string)$cfRule->formula); |
|
97 | + $objConditional->addCondition((string) $cfRule->formula); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | if (isset($cfRule->dataBar)) { |
101 | 101 | $objConditional->setDataBar($this->readDataBarOfConditionalRule($cfRule, $conditionalFormattingRuleExtensions)); |
102 | 102 | } else { |
103 | - $objConditional->setStyle(clone $this->dxfs[(int)($cfRule['dxfId'])]); |
|
103 | + $objConditional->setStyle(clone $this->dxfs[(int) ($cfRule['dxfId'])]); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $conditionalStyles[] = $objConditional; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $dataBar = new ConditionalDataBar(); |
115 | 115 | //dataBar attribute |
116 | 116 | if (isset($cfRule->dataBar['showValue'])) { |
117 | - $dataBar->setShowValue((boolean)$cfRule->dataBar['showValue']); |
|
117 | + $dataBar->setShowValue((boolean) $cfRule->dataBar['showValue']); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | //dataBar children |
@@ -123,24 +123,24 @@ discard block |
||
123 | 123 | $cfvoIndex = 0; |
124 | 124 | foreach ((count($cfvoXml) > 1 ? $cfvoXml : [$cfvoXml]) as $cfvo) { |
125 | 125 | if ($cfvoIndex === 0) { |
126 | - $dataBar->setMinimumConditionalFormatValueObject(new ConditionalFormatValueObject((string)$cfvo['type'], (string)$cfvo['val'])); |
|
126 | + $dataBar->setMinimumConditionalFormatValueObject(new ConditionalFormatValueObject((string) $cfvo['type'], (string) $cfvo['val'])); |
|
127 | 127 | } |
128 | 128 | if ($cfvoIndex === 1) { |
129 | - $dataBar->setMaximumConditionalFormatValueObject(new ConditionalFormatValueObject((string)$cfvo['type'], (string)$cfvo['val'])); |
|
129 | + $dataBar->setMaximumConditionalFormatValueObject(new ConditionalFormatValueObject((string) $cfvo['type'], (string) $cfvo['val'])); |
|
130 | 130 | } |
131 | 131 | $cfvoIndex++; |
132 | 132 | } |
133 | 133 | |
134 | 134 | //color |
135 | 135 | if (isset($cfRule->dataBar->color)) { |
136 | - $dataBar->setColor((string)$cfRule->dataBar->color['rgb']); |
|
136 | + $dataBar->setColor((string) $cfRule->dataBar->color['rgb']); |
|
137 | 137 | } |
138 | 138 | //extLst |
139 | 139 | if (isset($cfRule->extLst)) { |
140 | 140 | $ns = $cfRule->extLst->getNamespaces(true); |
141 | 141 | foreach ((count($cfRule->extLst) > 0 ? $cfRule->extLst->ext : [$cfRule->extLst->ext]) as $ext) { |
142 | - $extId = (string)$ext->children($ns['x14'])->id; |
|
143 | - if (isset($conditionalFormattingRuleExtensions[$extId]) && (string)$ext['uri'] === '{B025F937-C7B1-47D3-B67F-A62EFF666E3E}') { |
|
142 | + $extId = (string) $ext->children($ns['x14'])->id; |
|
143 | + if (isset($conditionalFormattingRuleExtensions[$extId]) && (string) $ext['uri'] === '{B025F937-C7B1-47D3-B67F-A62EFF666E3E}') { |
|
144 | 144 | $dataBar->setConditionalFormattingRuleExt($conditionalFormattingRuleExtensions[$extId]); |
145 | 145 | } |
146 | 146 | } |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | |
324 | 324 | // Set Zero Height row |
325 | 325 | if ( |
326 | - (string)$pSheet->getDefaultRowDimension()->getZeroHeight() === '1' || |
|
327 | - strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' |
|
326 | + (string) $pSheet->getDefaultRowDimension()->getZeroHeight() === '1' || |
|
327 | + strtolower((string) $pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' |
|
328 | 328 | ) { |
329 | 329 | $objWriter->writeAttribute('zeroHeight', '1'); |
330 | 330 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $outlineLevelRow = $dimension->getOutlineLevel(); |
342 | 342 | } |
343 | 343 | } |
344 | - $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow); |
|
344 | + $objWriter->writeAttribute('outlineLevelRow', (int) $outlineLevelRow); |
|
345 | 345 | |
346 | 346 | // Outline level - column |
347 | 347 | $outlineLevelCol = 0; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $outlineLevelCol = $dimension->getOutlineLevel(); |
351 | 351 | } |
352 | 352 | } |
353 | - $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol); |
|
353 | + $objWriter->writeAttribute('outlineLevelCol', (int) $outlineLevelCol); |
|
354 | 354 | |
355 | 355 | $objWriter->endElement(); |
356 | 356 | } |
@@ -567,15 +567,15 @@ discard block |
||
567 | 567 | $minCfvo = $dataBar->getMinimumConditionalFormatValueObject(); |
568 | 568 | if ($minCfvo) { |
569 | 569 | $objWriter->startElement('cfvo'); |
570 | - self::writeAttributeIf($objWriter, $minCfvo->getType(), 'type', (string)$minCfvo->getType()); |
|
571 | - self::writeAttributeIf($objWriter, $minCfvo->getValue(), 'val', (string)$minCfvo->getValue()); |
|
570 | + self::writeAttributeIf($objWriter, $minCfvo->getType(), 'type', (string) $minCfvo->getType()); |
|
571 | + self::writeAttributeIf($objWriter, $minCfvo->getValue(), 'val', (string) $minCfvo->getValue()); |
|
572 | 572 | $objWriter->endElement(); |
573 | 573 | } |
574 | 574 | $maxCfvo = $dataBar->getMaximumConditionalFormatValueObject(); |
575 | 575 | if ($maxCfvo) { |
576 | 576 | $objWriter->startElement('cfvo'); |
577 | - self::writeAttributeIf($objWriter, $maxCfvo->getType(), 'type', (string)$maxCfvo->getType()); |
|
578 | - self::writeAttributeIf($objWriter, $maxCfvo->getValue(), 'val', (string)$maxCfvo->getValue()); |
|
577 | + self::writeAttributeIf($objWriter, $maxCfvo->getType(), 'type', (string) $maxCfvo->getType()); |
|
578 | + self::writeAttributeIf($objWriter, $maxCfvo->getValue(), 'val', (string) $maxCfvo->getValue()); |
|
579 | 579 | $objWriter->endElement(); |
580 | 580 | } |
581 | 581 | if ($dataBar->getColor()) { |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | //force a decimal to be written if the type is float |
1198 | 1198 | if (is_float($cellValue)) { |
1199 | 1199 | // force point as decimal separator in case current locale uses comma |
1200 | - $cellValue = str_replace(',', '.', (string)$cellValue); |
|
1200 | + $cellValue = str_replace(',', '.', (string) $cellValue); |
|
1201 | 1201 | if (strpos($cellValue, '.') === false) { |
1202 | 1202 | $cellValue = $cellValue . '.0'; |
1203 | 1203 | } |