PHP Class Yasumi\Yasumi

Datei anzeigen Open project: azuyalabs/yasumi Class Usage Examples

Public Methods

Method 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 method

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)
return Yasumi\Provider\AbstractProvider An instance of class $class is created and returned

getAvailableLocales() public static method

Returns a list of available locales.
public static getAvailableLocales ( ) : array
return array list of available locales

getProviders() public static method

Returns a list of available holiday providers.
public static getProviders ( ) : array
return array list of available holiday providers

nextWorkingDay() public static method

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

prevWorkingDay() public static method

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