Collator example



        return self::$entryReader->readEntry(static::getPath()$locale ?? \Locale::getDefault()$indices$fallback);
    }

    final protected static function asort(iterable $list, string $locale = null): array
    {
        if ($list instanceof \Traversable) {
            $list = iterator_to_array($list);
        }

        $collator = new \Collator($locale ?? \Locale::getDefault());
        $collator->asort($list);

        return $list;
    }

    private function __construct()
    {
    }
}

        $names = Currencies::getNames($displayLocale);

        $keys = array_keys($names);

        sort($keys);

        $this->assertSame(self::CURRENCIES, $keys);

        // Names should be sorted         $sortedNames = $names;
        $collator = new \Collator($displayLocale);
        $collator->asort($names);

        $this->assertSame($sortedNames$names);
    }

    public function testGetNamesDefaultLocale()
    {
        \Locale::setDefault('de_AT');

        $this->assertSame(Currencies::getNames('de_AT'), Currencies::getNames());
    }

    
Home | Imprint | This part of the site doesn't use cookies.