diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9b9e926..4148fec95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Nothing yet. +### Removed + +- The following items were deprecated in release 2 and are now removed. +- Writer\Xls\Style\ColorMap (no longer needed). +- Reader\Xml::trySimpleXMLLoadString (should not have been public, no public replacement). +- Calculation\Calculation::_translateFormulaToLocale (use method name translateFormulaToLocale without leading underscore). +- Calculation\Calculation::_translateFormulaToEnglish (use method name translateFormulaToEnglish without leading underscore). + ### Moved - Nothing yet. diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 120b197af..6fa1dde2c 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -3318,16 +3318,6 @@ class Calculation private static ?array $functionReplaceToLocale; - /** - * @deprecated 1.30.0 use translateFormulaToLocale() instead - * - * @codeCoverageIgnore - */ - public function _translateFormulaToLocale(string $formula): string - { - return $this->translateFormulaToLocale($formula); - } - public function translateFormulaToLocale(string $formula): string { $formula = preg_replace(self::CALCULATION_REGEXP_STRIP_XLFN_XLWS, '', $formula) ?? ''; @@ -3365,16 +3355,6 @@ class Calculation private static ?array $functionReplaceToExcel; - /** - * @deprecated 1.30.0 use translateFormulaToEnglish() instead - * - * @codeCoverageIgnore - */ - public function _translateFormulaToEnglish(string $formula): string - { - return $this->translateFormulaToEnglish($formula); - } - public function translateFormulaToEnglish(string $formula): string { if (self::$functionReplaceFromLocale === null) { diff --git a/src/PhpSpreadsheet/Reader/Xml.php b/src/PhpSpreadsheet/Reader/Xml.php index e86fcd4c7..e0f218747 100644 --- a/src/PhpSpreadsheet/Reader/Xml.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -107,20 +107,6 @@ class Xml extends BaseReader return $valid; } - /** - * Check if the file is a valid SimpleXML. - * - * @return false|SimpleXMLElement - * - * @deprecated 2.0.1 Should never have had public visibility - * - * @codeCoverageIgnore - */ - public function trySimpleXMLLoadString(string $filename, string $fileOrString = 'file'): SimpleXMLElement|bool - { - return $this->trySimpleXMLLoadStringPrivate($filename, $fileOrString); - } - /** @return false|SimpleXMLElement */ private function trySimpleXMLLoadStringPrivate(string $filename, string $fileOrString = 'file'): SimpleXMLElement|bool { diff --git a/src/PhpSpreadsheet/Writer/Xls/Style/ColorMap.php b/src/PhpSpreadsheet/Writer/Xls/Style/ColorMap.php deleted file mode 100644 index 209d13bce..000000000 --- a/src/PhpSpreadsheet/Writer/Xls/Style/ColorMap.php +++ /dev/null @@ -1,98 +0,0 @@ - - */ - private static array $colorMap = [ - '#000000' => 0x08, - '#FFFFFF' => 0x09, - '#FF0000' => 0x0A, - '#00FF00' => 0x0B, - '#0000FF' => 0x0C, - '#FFFF00' => 0x0D, - '#FF00FF' => 0x0E, - '#00FFFF' => 0x0F, - '#800000' => 0x10, - '#008000' => 0x11, - '#000080' => 0x12, - '#808000' => 0x13, - '#800080' => 0x14, - '#008080' => 0x15, - '#C0C0C0' => 0x16, - '#808080' => 0x17, - '#9999FF' => 0x18, - '#993366' => 0x19, - '#FFFFCC' => 0x1A, - '#CCFFFF' => 0x1B, - '#660066' => 0x1C, - '#FF8080' => 0x1D, - '#0066CC' => 0x1E, - '#CCCCFF' => 0x1F, - // '#000080' => 0x20, - // '#FF00FF' => 0x21, - // '#FFFF00' => 0x22, - // '#00FFFF' => 0x23, - // '#800080' => 0x24, - // '#800000' => 0x25, - // '#008080' => 0x26, - // '#0000FF' => 0x27, - '#00CCFF' => 0x28, - // '#CCFFFF' => 0x29, - '#CCFFCC' => 0x2A, - '#FFFF99' => 0x2B, - '#99CCFF' => 0x2C, - '#FF99CC' => 0x2D, - '#CC99FF' => 0x2E, - '#FFCC99' => 0x2F, - '#3366FF' => 0x30, - '#33CCCC' => 0x31, - '#99CC00' => 0x32, - '#FFCC00' => 0x33, - '#FF9900' => 0x34, - '#FF6600' => 0x35, - '#666699' => 0x36, - '#969696' => 0x37, - '#003366' => 0x38, - '#339966' => 0x39, - '#003300' => 0x3A, - '#333300' => 0x3B, - '#993300' => 0x3C, - // '#993366' => 0x3D, - '#333399' => 0x3E, - '#333333' => 0x3F, - ]; - - public static function lookup(Color $color, int $defaultIndex = 0x00): int - { - $colorRgb = strtoupper($color->getRGB()); - if (is_string($colorRgb) && array_key_exists("#{$colorRgb}", self::$colorMap)) { - return self::$colorMap["#{$colorRgb}"]; - } - -// TODO Try and map RGB value to nearest colour within the define pallette -// $red = Color::getRed($colorRgb, false); -// $green = Color::getGreen($colorRgb, false); -// $blue = Color::getBlue($colorRgb, false); - -// $paletteSpace = 3; -// $newColor = ($red * $paletteSpace / 256) * ($paletteSpace * $paletteSpace) + -// ($green * $paletteSpace / 256) * $paletteSpace + -// ($blue * $paletteSpace / 256); - - return $defaultIndex; - } -} diff --git a/tests/PhpSpreadsheetTests/Calculation/TranslationTest.php b/tests/PhpSpreadsheetTests/Calculation/TranslationTest.php index ec9a2acaf..a3b846023 100644 --- a/tests/PhpSpreadsheetTests/Calculation/TranslationTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/TranslationTest.php @@ -43,10 +43,10 @@ class TranslationTest extends TestCase self::markTestSkipped("Unable to set locale to {$locale}"); } - $translatedFormula = Calculation::getInstance()->_translateFormulaToLocale($formula); + $translatedFormula = Calculation::getInstance()->translateFormulaToLocale($formula); self::assertSame($expectedResult, $translatedFormula); - $restoredFormula = Calculation::getInstance()->_translateFormulaToEnglish($translatedFormula); + $restoredFormula = Calculation::getInstance()->translateFormulaToEnglish($translatedFormula); self::assertSame(preg_replace(Calculation::CALCULATION_REGEXP_STRIP_XLFN_XLWS, '', $formula), $restoredFormula); }