CoreAPI
in package

Facade of the Hotel Booking core. Any code outside the core must use it instead of inner objects and functions. All object caching must be placed here!

Table of Contents

WP_CACHE_GROUP  = 'MPHB'
__construct()  : mixed
formatPrice()  : mixed
getActiveRoomsCountForRoomType()  : mixed
getBlockedRoomsCountsForRoomType()  : mixed
getBookedDaysForRoomType()  : array<string|int, mixed>
getDatesRatesForRoomType()  : array<string|int, mixed>
getMinRoomTypeBasePriceForDate()  : float
getRoomTypeActiveRates()  : array<string|int, mixed>
getRoomTypeAvailabilityData()  : RoomTypeAvailabilityData
getRoomTypeAvailabilityStatus()  : RoomTypeAvailabilityStatus
getRoomTypeById()  : RoomType
isBookedDate()  : true
isCheckInNotAllowed()  : bool
isCheckOutNotAllowed()  : bool
isStayInNotAllowed()  : bool
addClearObjectCacheHooks()  : mixed
deleteCachedData()  : mixed
getCachedData()  : mixed
getCacheKeysPrefix()  : mixed
setCachedData()  : mixed

Constants

WP_CACHE_GROUP

public mixed WP_CACHE_GROUP = 'MPHB'

Methods

__construct()

public __construct() : mixed
Return values
mixed

formatPrice()

public formatPrice(float $price[, array<string|int, mixed> $atts = array() ]) : mixed
Parameters
$price : float
$atts : array<string|int, mixed> = array()

with: 'decimal_separator' => string, 'thousand_separator' => string, 'decimals' => int, Number of decimals 'is_truncate_price' => bool, false by default 'currency_position' => string, Possible values: after, before, after_space, before_space 'currency_symbol' => string, 'literal_free' => bool, Use "Free" text instead of 0 price. 'trim_zeros' => bool, true by default 'period' => bool, 'period_title' => '', 'period_nights' => 1, 'as_html' => bool, true by default

Return values
mixed

getActiveRoomsCountForRoomType()

public getActiveRoomsCountForRoomType(int $roomTypeOriginalId) : mixed
Parameters
$roomTypeOriginalId : int
Return values
mixed

getBlockedRoomsCountsForRoomType()

public getBlockedRoomsCountsForRoomType(int $roomTypeOriginalId) : mixed
Parameters
$roomTypeOriginalId : int
Return values
mixed

getBookedDaysForRoomType()

public getBookedDaysForRoomType(int $roomTypeOriginalId) : array<string|int, mixed>
Parameters
$roomTypeOriginalId : int
Return values
array<string|int, mixed>

with [ 'booked' => [ 'Y-m-d' => rooms count, ... ], 'check-ins' => [ 'Y-m-d' => rooms count, ... ], 'check-outs' => [ 'Y-m-d' => rooms count, ... ], ]

getDatesRatesForRoomType()

public getDatesRatesForRoomType(int $roomTypeOriginalId) : array<string|int, mixed>
Parameters
$roomTypeOriginalId : int
Return values
array<string|int, mixed>

with dates (string in format Y-m-d) which have rate

getMinRoomTypeBasePriceForDate()

public getMinRoomTypeBasePriceForDate(int $roomTypeOriginalId, DateTime $startDate) : float
Parameters
$roomTypeOriginalId : int
$startDate : DateTime
Tags
throws
Exception

if booking is not allowed for given date

Return values
float

room type minimal price for min days stay with taxes and fees

getRoomTypeActiveRates()

public getRoomTypeActiveRates(int $roomTypeOriginalId) : array<string|int, mixed>
Parameters
$roomTypeOriginalId : int
Return values
array<string|int, mixed>

with \MPHB\Entities\Rate

getRoomTypeAvailabilityData()

public getRoomTypeAvailabilityData(int $roomTypeOriginalId, DateTime $date) : RoomTypeAvailabilityData
Parameters
$roomTypeOriginalId : int
$date : DateTime
Return values
RoomTypeAvailabilityData

getRoomTypeAvailabilityStatus()

public getRoomTypeAvailabilityStatus(int $roomTypeOriginalId, DateTime $date) : RoomTypeAvailabilityStatus
Parameters
$roomTypeOriginalId : int
$date : DateTime
Return values
RoomTypeAvailabilityStatus

constant

getRoomTypeById()

public getRoomTypeById(int $roomTypeId) : RoomType
Parameters
$roomTypeId : int
Return values
RoomType

or null if nothing is found

isBookedDate()

public isBookedDate(int $roomTypeOriginalId, DateTime $date[,  $considerCheckIn = true ][,  $considerCheckOut = false ]) : true
Parameters
$roomTypeOriginalId : int
$date : DateTime
$considerCheckIn : = true
  • if true then check-in date considered as booked if there is no any available room
$considerCheckOut : = false
  • if true then check-out date considered as booked if there is no any available room
Return values
true

if given date is booked (there is no any available room)

isCheckInNotAllowed()

public isCheckInNotAllowed(int $roomTypeOriginalId, DateTime $date) : bool
Parameters
$roomTypeOriginalId : int
$date : DateTime
Return values
bool
  • true if check-in is not allowed in the given date

isCheckOutNotAllowed()

public isCheckOutNotAllowed(int $roomTypeOriginalId, DateTime $date) : bool
Parameters
$roomTypeOriginalId : int
$date : DateTime
Return values
bool
  • true if check-out is not allowed in the given date

isStayInNotAllowed()

public isStayInNotAllowed(int $roomTypeOriginalId, DateTime $checkInDate, DateTime $checkOutDate) : bool
Parameters
$roomTypeOriginalId : int
$checkInDate : DateTime
$checkOutDate : DateTime
Return values
bool
  • true if stay-in is not allowed in the given dates period

addClearObjectCacheHooks()

private addClearObjectCacheHooks() : mixed
Return values
mixed

deleteCachedData()

private deleteCachedData() : mixed
Return values
mixed

getCachedData()

private getCachedData(string $cacheDataId[, mixed &$isCachedDataWasFound = null ]) : mixed
Parameters
$cacheDataId : string
$isCachedDataWasFound : mixed = null
Return values
mixed

getCacheKeysPrefix()

private getCacheKeysPrefix() : mixed
Return values
mixed

setCachedData()

private setCachedData(string $cacheDataId, mixed $data) : mixed
Parameters
$cacheDataId : string
$data : mixed
Return values
mixed

Search results