Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DateCaster.php

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\Caster

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal