Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Timezone.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class Timezone
15 {
19  protected $lists;
20 
26  public function __construct(Lists $lists)
27  {
28  $this->lists = $lists;
29  }
30 
38  public function isValid($timezoneCode)
39  {
40  $isValid = true;
41  $allowedTimezoneCodes = array_keys($this->lists->getTimezoneList());
42 
43  if (!$timezoneCode || !in_array($timezoneCode, $allowedTimezoneCodes)) {
44  $isValid = false;
45  }
46 
47  return $isValid;
48  }
49 }