You are here

final class DatexPersianIntlCalendar in Datex 8

Hierarchy

Expanded class hierarchy of DatexPersianIntlCalendar

1 file declares its use of DatexPersianIntlCalendar
datex.module in ./datex.module

File

src/Datex/DatexPersianIntlCalendar.php, line 5

Namespace

Drupal\datex\Datex
View source
final class DatexPersianIntlCalendar extends DatexIntlCalendar {
  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 DatexPersianIntlCalendar($this->timezone, $this->calendar, $this->langCode);
  }
  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);
  }
  function getBaseYear() {
    return 1390;
  }

}

Members

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