PHP Class Yasumi\Yasumi

Afficher le fichier Open project: azuyalabs/yasumi Class Usage Examples

Méthodes publiques

Méthode Description
create ( string $class, integer $year = null, string $locale = self::DEFAULT_LOCALE ) : AbstractProvider Create a new holiday provider instance.
getAvailableLocales ( ) : array Returns a list of available locales.
getProviders ( ) : array Returns a list of available holiday providers.
nextWorkingDay ( string $class, $startDate, $workingDays = 1 ) : DateTime
prevWorkingDay ( string $class, $startDate, $workingDays = 1 ) : DateTime

Method Details

create() public static méthode

A new holiday provider instance can be created using this function. You can use one of the providers included already with Yasumi, or your own provider by giving the name of your class in the first parameter. Your provider class needs to implement the 'ProviderInterface' class.
public static create ( string $class, integer $year = null, string $locale = self::DEFAULT_LOCALE ) : AbstractProvider
$class string holiday provider name
$year integer year for which the country provider needs to be created. Year needs to be a valid integer between 1000 and 9999.
$locale string The locale to use. If empty we'll use the default locale (en_US)
Résultat Yasumi\Provider\AbstractProvider An instance of class $class is created and returned

getAvailableLocales() public static méthode

Returns a list of available locales.
public static getAvailableLocales ( ) : array
Résultat array list of available locales

getProviders() public static méthode

Returns a list of available holiday providers.
public static getProviders ( ) : array
Résultat array list of available holiday providers

nextWorkingDay() public static méthode

public static nextWorkingDay ( string $class, $startDate, $workingDays = 1 ) : DateTime
$class string holiday provider name
$startDate DateTime Start date, defaults to today
$workingDays int
Résultat DateTime

prevWorkingDay() public static méthode

public static prevWorkingDay ( string $class, $startDate, $workingDays = 1 ) : DateTime
$class string holiday provider name
$startDate DateTime Start date, defaults to today
$workingDays int
Résultat DateTime