Ejemplo n.º 1
0
 /**
  * Retrieve the first weekday for a specific locale (from 0-Sunday to 6-Saturnday)
  * @param string $locale = '' The locale to use. If empty we'll use the default locale set in \Punic\Data
  * @return int Returns a number from 0 (Sunday) to 7 (Saturnday)
  */
 public static function getFirstWeekday($locale = '')
 {
     static $cache = array();
     $locale = empty($locale) ? \Punic\Data::getDefaultLocale() : $locale;
     if (!array_key_exists($locale, $cache)) {
         $result = 0;
         $data = \Punic\Data::getGeneric('weekData');
         $i = \Punic\Data::getTerritoryNode($data['firstDay'], $locale);
         if (is_int($i)) {
             $result = $i;
         }
         $cache[$locale] = $result;
     }
     return $cache[$locale];
 }