You are here

final class CalendarSystemsPersianIntlCalendar in Calendar Systems 8.3

Hierarchy

Expanded class hierarchy of CalendarSystemsPersianIntlCalendar

1 file declares its use of CalendarSystemsPersianIntlCalendar
calendar_systems.module in ./calendar_systems.module

File

src/CalendarSystems/CalendarSystemsPersianIntlCalendar.php, line 5

Namespace

Drupal\calendar_systems\CalendarSystems
View source
final class CalendarSystemsPersianIntlCalendar extends CalendarSystemsIntlCalendar {
  function validate(array $arr) {
    if ((!isset($arr['year']) || empty($arr['year'])) && (!isset($arr['month']) || empty($arr['month'])) && (!isset($arr['day']) || empty($arr['day']))) {
      return NULL;
    }
    $zero = TRUE;
    $year = intval($arr['year']);
    $month = intval($arr['month']);
    $day = intval($arr['day']);
    if ($year < 0 || $year === 0 && $zero) {
      return t('Year out of range');
    }
    if ($month < 0 || 12 < $month || $month === 0 && $zero) {
      return t('Month out of range');
    }
    if ($day === 0 && $zero || $day < 0 || 31 < $day || $month > 6 && $day > 30 || $month === 12 && $day > 29) {
      return t('Day out of range');
    }
    return FALSE;
  }
  function copy() {
    return new CalendarSystemsPersianIntlCalendar($this->timezone, $this->calendar, $this->langCode);
  }
  function getBaseYear() {
    return 1390;
  }
  protected function formatHook($format, $value) {
    $characters = [
      '۰' => '0',
      '۱' => '1',
      '۲' => '2',
      '۳' => '3',
      '۴' => '4',
      '۵' => '5',
      '۶' => '6',
      '۷' => '7',
      '۸' => '8',
      '۹' => '9',
      '٠' => '0',
      '١' => '1',
      '٢' => '2',
      '٣' => '3',
      '٤' => '4',
      '٥' => '5',
      '٦' => '6',
      '٧' => '7',
      '٨' => '8',
      '٩' => '9',
    ];
    return strtr($value, $characters);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CalendarSystemsIntlCalendar::$intlFormatter protected property
CalendarSystemsIntlCalendar::$locale protected property
CalendarSystemsIntlCalendar::$php2intl_format_map private static property php's date format modifiers differ from Intl's. This is a mapping of the two.
CalendarSystemsIntlCalendar::$remove_pattern private static property Some format modifiers are not supported in intl. They are simply removed.
CalendarSystemsIntlCalendar::format public function Overrides CalendarSystemsInterface::format
CalendarSystemsIntlCalendar::format2pattern private static function
CalendarSystemsIntlCalendar::intl private static function
CalendarSystemsIntlCalendar::parse public function Overrides CalendarSystemsInterface::parse
CalendarSystemsIntlCalendar::setDateLocale public function Overrides CalendarSystemsInterface::setDateLocale
CalendarSystemsIntlCalendar::toGregorian private static function
CalendarSystemsIntlCalendar::__construct public function Overrides CalendarSystemsPartialImplementation::__construct
CalendarSystemsPartialImplementation::$calendar protected property
CalendarSystemsPartialImplementation::$langCode protected property
CalendarSystemsPartialImplementation::$origin protected property
CalendarSystemsPartialImplementation::$timezone protected property
CalendarSystemsPartialImplementation::formatArray final function Overrides CalendarSystemsInterface::formatArray
CalendarSystemsPartialImplementation::getCalendarName final function Overrides CalendarSystemsInterface::getCalendarName
CalendarSystemsPartialImplementation::getLangcode function Overrides CalendarSystemsInterface::getLangcode
CalendarSystemsPartialImplementation::getOrigin protected function
CalendarSystemsPartialImplementation::getTimestamp final function Overrides CalendarSystemsInterface::getTimestamp
CalendarSystemsPartialImplementation::listOptions function Overrides CalendarSystemsInterface::listOptions
CalendarSystemsPartialImplementation::setTime final function Overrides CalendarSystemsInterface::setTime
CalendarSystemsPartialImplementation::setTimestamp final function Overrides CalendarSystemsInterface::setTimestamp
CalendarSystemsPartialImplementation::tz final protected function
CalendarSystemsPartialImplementation::xFormat final function Format date time, in gregorian. Overrides CalendarSystemsInterface::xFormat
CalendarSystemsPartialImplementation::xFormatArray final function Put all day and time parts in an array, in gregorian. Overrides CalendarSystemsInterface::xFormatArray
CalendarSystemsPartialImplementation::xSetDate final function Overrides CalendarSystemsInterface::xSetDate
CalendarSystemsPersianIntlCalendar::copy function Overrides CalendarSystemsIntlCalendar::copy
CalendarSystemsPersianIntlCalendar::formatHook protected function Overrides CalendarSystemsIntlCalendar::formatHook
CalendarSystemsPersianIntlCalendar::getBaseYear function Overrides CalendarSystemsIntlCalendar::getBaseYear
CalendarSystemsPersianIntlCalendar::validate function Overrides CalendarSystemsPartialImplementation::validate