PHP Класс Yasumi\Holiday

Наследование: extends DateTim\DateTime, implements JsonSerializabl\JsonSerializable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$shortName short name (internal name) of this holiday
$translations list of translations of this holiday

Открытые методы

Метод Описание
__construct ( string $shortName, array $names, DateTime $date, string $displayLocale = self::DEFAULT_LOCALE, string $type = self::TYPE_NATIONAL ) Creates a new Holiday.
__toString ( ) : string Format the instance as a string using the set format.
getName ( ) Returns the name of this holiday.
getType ( ) : string Returns what type this holiday is.
jsonSerialize ( ) Serializes the object to a value that can be serialized natively by json_encode().
mergeGlobalTranslations ( yasumi\TranslationsInterface $globalTranslations ) Merges local translations (preferred) with global translations.

Описание методов

__construct() публичный Метод

If a holiday date needs to be defined for a specific timezone, make sure that the date instance (DateTime) has the correct timezone set. Otherwise the default system timezone is used.
public __construct ( string $shortName, array $names, DateTime $date, string $displayLocale = self::DEFAULT_LOCALE, string $type = self::TYPE_NATIONAL )
$shortName string The short name (internal name) of this holiday
$names array An array containing the name/description of this holiday in various languages. Overrides global translations
$date DateTime A DateTime instance representing the date of the holiday
$displayLocale string Locale (i.e. language) in which the holiday information needs to be displayed in. (Default 'en_US')
$type string The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE, TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.

__toString() публичный Метод

Format the instance as a string using the set format.
public __toString ( ) : string
Результат string

getName() публичный Метод

The name of this holiday is returned translated in the given locale. If for the given locale no translation is defined, the name in the default locale ('en_US') is returned. In case there is no translation at all, the short internal name is returned.
public getName ( )

getType() публичный Метод

Returns what type this holiday is.
public getType ( ) : string
Результат string the type of holiday (national, observance, season or bank).

jsonSerialize() публичный Метод

Serializes the object to a value that can be serialized natively by json_encode().
public jsonSerialize ( )

mergeGlobalTranslations() публичный Метод

Merges local translations (preferred) with global translations.
public mergeGlobalTranslations ( yasumi\TranslationsInterface $globalTranslations )
$globalTranslations yasumi\TranslationsInterface global translations

Описание свойств

$shortName публичное свойство

short name (internal name) of this holiday
public $shortName

$translations публичное свойство

list of translations of this holiday
public $translations