TimezoneChoice final class
Minn\Support\TimezoneChoice · public/minn/src/Minn/Support/TimezoneChoice.php · 109 lines
The timezone choices a settings form offers (wp_timezone_choice, probe placeholder-helpers): the zones of each continent, cities in natural order (a zone with three parts reads "City - Sub-city"), then UTC, then the offsets set by hand. "Select a city" leads when nothing is chosen, and a real zone outside the list (an old name, Etc/) leads when it is the one chosen. Each choice is a line of its own.
Constants and properties
| private | CONTINENTS = array ( 0 => 'Africa', 1 => 'America', 2 => 'Antarctica', 3 => 'Arctic', 4 => 'Asia', 5 => 'Atlantic', 6 => 'Australia', 7 => 'Europe', 8 => 'Indian', 9 => 'Pacific', ) |
Public
| static | html(string $selected, Closure $translate): string# | The choices as option lines, the chosen zone marked.
|
Internals 6
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | zones(Closure $translate): array# | The continents' zones in order: continent, city, then sub-city, each compared naturally and without case. @return list<array{value: string, continent: string, city: string, sub: string, label: string}> | |||
| private | groups(array $zones): array# |
@return array<string, list<array{value: string, continent: string, city: string, sub: string, label: string}>> | |||
| private | outsideList(string $selected, array $listed): bool# | Whether a chosen zone is a real one the list leaves out (not UTC, not an offset). @param list<string> $listed
| |||
| private | offset(int|float $offset): array# | An offset's value (UTC+5.75) and label (UTC+5:45). @return array{0: string, 1: string} @return array{0: string, 1: string} | |||
| private | offsets(): array# | The offsets offered by hand, in hours, lowest first: every half hour from -12 to +12, the three-quarter hours some zones keep, and the hours past +12 up to +14. @return list<float|int> | |||
| private | option(string $value, string $label, string $chosen): string# | One choice, marked when it is the chosen zone. |
Nothing matches.