function DateCaster::castTimeZone
File
-
vendor/
symfony/ var-dumper/ Caster/ DateCaster.php, line 79
Class
- DateCaster
- Casts DateTimeInterface related classes to array representation.
Namespace
Symfony\Component\VarDumper\CasterCode
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter) : array {
$location = $timeZone->getLocation();
$formatted = (new \DateTimeImmutable('now', $timeZone))->format($location ? 'e (P)' : 'P');
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-' . $location['country_code']) : '';
$z = [
Caster::PREFIX_VIRTUAL . 'timezone' => new ConstStub($formatted, $title),
];
return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
}