Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
Locale.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class Locale
15 {
19  protected $lists;
20 
26  public function __construct(Lists $lists)
27  {
28  $this->lists = $lists;
29  }
30 
39  public function isValid($localeCode)
40  {
41  $isValid = true;
42  $allowedLocaleCodes = array_keys($this->lists->getLocaleList());
43 
44  if (!$localeCode || !in_array($localeCode, $allowedLocaleCodes)) {
45  $isValid = false;
46  }
47 
48  return $isValid;
49  }
50 }