PHP Class business\Business

Author: Florian Voutzinos ([email protected])
Inheritance: implements business\BusinessInterface, implements Serializable, implements JsonSerializable
Exibir arquivo Open project: florianv/business Class Usage Examples

Public Methods

Method Description
__construct ( array $days, Holidays | DateTime[] | null $holidays = null, DateTimeZone $timezone = null ) Creates a new business.
closest ( DateTime $date, $mode = self::CLOSEST_NEXT )
jsonSerialize ( )
serialize ( )
timeline ( DateTime $start, DateTime $end, DateInterval $interval )
unserialize ( $serialized )
within ( DateTime $date )

Private Methods

Method Description
addDay ( business\DayInterface $day ) Adds a day.
getClosestDateAfter ( DateTime $date ) : DateTime Gets the closest business date after the given date.
getClosestDateBefore ( DateTime $date ) : DateTime Gets the closest business date before the given date.
getClosestDayAfter ( integer $dayNumber ) : business\DayInterface | null Gets the closest business day after a given day number (including it).
getClosestDayBefore ( integer $dayNumber ) : business\DayInterface | null Gets the closest business day before a given day number (including it).
getDateAfter ( DateTime $date ) : DateTime Gets the business date after the given date (excluding holidays).
getDateBefore ( DateTime $date ) : DateTime Gets the business date before the given date (excluding holidays).
getDay ( integer $dayNumber ) : business\DayInterface | null Gets the day corresponding to the day number.
getDayAfter ( integer $dayNumber ) : business\DayInterface | null Gets the business day after the day number.
getDayBefore ( integer $dayNumber ) : business\DayInterface | null Gets the business day before the day number.
setDays ( array $days ) Adds a set of days.

Method Details

__construct() public method

Creates a new business.
public __construct ( array $days, Holidays | DateTime[] | null $holidays = null, DateTimeZone $timezone = null )
$days array
$holidays Holidays | DateTime[] | null
$timezone DateTimeZone

closest() public method

public closest ( DateTime $date, $mode = self::CLOSEST_NEXT )
$date DateTime

jsonSerialize() public method

public jsonSerialize ( )

serialize() public method

public serialize ( )

timeline() public method

public timeline ( DateTime $start, DateTime $end, DateInterval $interval )
$start DateTime
$end DateTime
$interval DateInterval

unserialize() public method

public unserialize ( $serialized )

within() public method

public within ( DateTime $date )
$date DateTime