CoreFiles by mySites.guru
CaseFolding.php33 lines, 822 bytes, from Joomla_6.0.0-Stable-Full_Package.zip
Raw History Compare with 5.4.12
md5
bfe5157909ffdd7810e0248ebe0dffdf
sha1
9ae0efe3d4f37f6f1837840ddb8f68dec3c50d26
sha256
b3328f045e89a988ad5fb64e28cea9cd439ed728a61456c16bb56e52c7e74624
<?php declare(strict_types=1);

namespace Algo26\IdnaConvert\NamePrep;

class CaseFolding
{
    private CaseFoldingData $caseFoldingData;

    public function __construct()
    {
        $this->caseFoldingData = new CaseFoldingData();
    }

    public function apply(array $inputArray, int $idnaVersion): array
    {
        if ($idnaVersion === 2003) {
            return $inputArray;
        }

        $outputArray = [];
        foreach ($inputArray as $codePoint) {
            if (isset($this->caseFoldingData->foldingMap[$codePoint])) {
                foreach ($this->caseFoldingData->foldingMap[$codePoint] as $folded) {
                    $outputArray[] = $folded;
                }
            } else {
                $outputArray[] = $codePoint;
            }
        }

        return $outputArray;
    }
}

The same content is in 50 releases, Joomla 6.0.0-beta1 to 6.3.0-alpha1. See them all, or every version of this file.