PHP Class Yasumi\Holiday

Inheritance: extends DateTim\DateTime, implements JsonSerializabl\JsonSerializable
Afficher le fichier Open project: azuyalabs/yasumi Class Usage Examples

Méthodes publiques

Свойство Type Description
$shortName short name (internal name) of this holiday
$translations list of translations of this holiday

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

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() public méthode

Format the instance as a string using the set format.
public __toString ( ) : string
Résultat string

getName() public méthode

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() public méthode

Returns what type this holiday is.
public getType ( ) : string
Résultat string the type of holiday (national, observance, season or bank).

jsonSerialize() public méthode

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

mergeGlobalTranslations() public méthode

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

Property Details

$shortName public_oe property

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

$translations public_oe property

list of translations of this holiday
public $translations