Recommendation
in package

Table of Contents

$rooms  : mixed
__construct()  : mixed
generate()  : mixed
count()  : array<string|int, mixed>
Calculate the count of each unique IDs in the array and group by ID.
exhaustiveSearch()  : mixed
filter()  : mixed
Filter excess free rooms. For example, no need to work with 10xTriple Room while only 10 places are required, it's enough 4 of them.
findAnything()  : mixed
Find the variant with the biggest capacity.
findApproximately()  : mixed
Search for variant, when we have enough places for adults and maximum places for children.
findSolution()  : mixed
Search for solution, when we have enough places both for adults and for children.
getRoomCapacity()  : mixed
greedySearch()  : mixed
sort()  : mixed
Sort from biggest to lowest capacity.

Properties

$rooms

private mixed $rooms = array()

Methods

__construct()

public __construct(array<string|int, mixed> $availableRooms) : mixed
Parameters
$availableRooms : array<string|int, mixed>

[%ID% => %free count%]

Return values
mixed

generate()

public generate(int $adults, int $children[, mixed $strict = false ]) : mixed
Parameters
$adults : int
$children : int
$strict : mixed = false
Return values
mixed

count()

Calculate the count of each unique IDs in the array and group by ID.

private count(mixed $recommendation) : array<string|int, mixed>
Parameters
$recommendation : mixed
Return values
array<string|int, mixed>

[%ID% => %count%]

exhaustiveSearch()

private exhaustiveSearch(mixed $adults, mixed $children, mixed &$rooms, mixed &$variants, mixed &$combinations) : mixed
Parameters
$adults : mixed
$children : mixed
$rooms : mixed
$variants : mixed
$combinations : mixed
Return values
mixed

filter()

Filter excess free rooms. For example, no need to work with 10xTriple Room while only 10 places are required, it's enough 4 of them.

private filter(mixed &$rooms, mixed $adults, mixed $children) : mixed
Parameters
$rooms : mixed
$adults : mixed
$children : mixed
Return values
mixed

findAnything()

Find the variant with the biggest capacity.

private findAnything(mixed $variants, mixed $combinations, mixed $adults, mixed $children) : mixed
Parameters
$variants : mixed
$combinations : mixed
$adults : mixed
$children : mixed
Return values
mixed

findApproximately()

Search for variant, when we have enough places for adults and maximum places for children.

private findApproximately(mixed $variants, mixed $combinations, mixed $adults, mixed $children) : mixed
Parameters
$variants : mixed
$combinations : mixed
$adults : mixed
$children : mixed
Return values
mixed

findSolution()

Search for solution, when we have enough places both for adults and for children.

private findSolution(mixed $variants, mixed $combinations, mixed $adults, mixed $children) : mixed
Parameters
$variants : mixed
$combinations : mixed
$adults : mixed
$children : mixed
Return values
mixed

getRoomCapacity()

private getRoomCapacity(mixed $id) : mixed
Parameters
$id : mixed
Return values
mixed

greedySearch()

private greedySearch(mixed $adults, mixed $children, mixed &$rooms, mixed &$variants, mixed &$combinations) : mixed
Parameters
$adults : mixed
$children : mixed
$rooms : mixed
$variants : mixed
$combinations : mixed
Return values
mixed

sort()

Sort from biggest to lowest capacity.

private sort(mixed &$rooms, mixed $adults, mixed $children) : mixed
Parameters
$rooms : mixed
$adults : mixed
$children : mixed
Return values
mixed

Search results