StackCalculator
in package
Quote from docs: Stacks may be used to substitute Initial Layer information about two or more Purposes and/or Special Features (also see Appendix B). Purposes must not be included in more than one Stack, and must not be presented as part of a Stack and outside of Stacks at the same time. Conversely, any Stacks used must not include the same Purpose more than once, nor include Purposes presented separately from Stacks.
Tags
Table of Contents
Constants
- DECLARATION_TYPE_DATA_CATEGORIES = 'dataCategories'
- DECLARATION_TYPE_FEATURES = 'features'
- DECLARATION_TYPE_PURPOSES = 'purposes'
- DECLARATION_TYPE_SPECIAL_FEATURES = 'specialFeatures'
- DECLARATION_TYPE_SPECIAL_PURPOSES = 'specialPurposes'
- DECLARATION_TYPES = [self::DECLARATION_TYPE_PURPOSES, self::DECLARATION_TYPE_SPECIAL_PURPOSES, self::DECLARATION_TYPE_FEATURES, self::DECLARATION_TYPE_SPECIAL_FEATURES, self::DECLARATION_TYPE_DATA_CATEGORIES]
- STACK_DECLARATIONS = [self::DECLARATION_TYPE_PURPOSES, self::DECLARATION_TYPE_SPECIAL_FEATURES]
Properties
- $originalStacks : mixed
- Clone stacks so we can obtain the original object by ID for the result.
- $scoreMap : mixed
- $stacks : mixed
- $usedDeclarations : mixed
Methods
- __construct() : mixed
- See class description.
- calculateBestSuitableStacks() : mixed
- Return best suitable stacks for the current used declarations.
- scoring() : mixed
- Rate each stack how many purposes and special features suit our used purposes, and remove unused stacks.
- sortByScore() : mixed
- Sort a given array of stacks by score.
- usedDeclarationToStack() : mixed
- Get best suitable stack for all our used purposes.
Constants
DECLARATION_TYPE_DATA_CATEGORIES
public
mixed
DECLARATION_TYPE_DATA_CATEGORIES
= 'dataCategories'
DECLARATION_TYPE_FEATURES
public
mixed
DECLARATION_TYPE_FEATURES
= 'features'
DECLARATION_TYPE_PURPOSES
public
mixed
DECLARATION_TYPE_PURPOSES
= 'purposes'
DECLARATION_TYPE_SPECIAL_FEATURES
public
mixed
DECLARATION_TYPE_SPECIAL_FEATURES
= 'specialFeatures'
DECLARATION_TYPE_SPECIAL_PURPOSES
public
mixed
DECLARATION_TYPE_SPECIAL_PURPOSES
= 'specialPurposes'
DECLARATION_TYPES
public
mixed
DECLARATION_TYPES
= [self::DECLARATION_TYPE_PURPOSES, self::DECLARATION_TYPE_SPECIAL_PURPOSES, self::DECLARATION_TYPE_FEATURES, self::DECLARATION_TYPE_SPECIAL_FEATURES, self::DECLARATION_TYPE_DATA_CATEGORIES]
STACK_DECLARATIONS
public
mixed
STACK_DECLARATIONS
= [self::DECLARATION_TYPE_PURPOSES, self::DECLARATION_TYPE_SPECIAL_FEATURES]
Properties
$originalStacks
Clone stacks so we can obtain the original object by ID for the result.
private
mixed
$originalStacks
$scoreMap
private
mixed
$scoreMap
= []
$stacks
private
mixed
$stacks
$usedDeclarations
private
mixed
$usedDeclarations
Methods
__construct()
See class description.
public
__construct(array<string|int, mixed> $stacks, array<string|int, mixed> $usedDeclarations) : mixed
Parameters
- $stacks : array<string|int, mixed>
-
A list of all available stacks (see
Query::stacks
) - $usedDeclarations : array<string|int, mixed>
-
List of used declarations as map (
purposes
andspecialPurposes
)
Tags
calculateBestSuitableStacks()
Return best suitable stacks for the current used declarations.
public
calculateBestSuitableStacks() : mixed
scoring()
Rate each stack how many purposes and special features suit our used purposes, and remove unused stacks.
protected
scoring() : mixed
sortByScore()
Sort a given array of stacks by score.
protected
sortByScore(array<string|int, mixed> &$stacks[, bool $truncateScores = false ]) : mixed
Parameters
- $stacks : array<string|int, mixed>
- $truncateScores : bool = false
-
If
true
, the score fields will be removed from the array
usedDeclarationToStack()
Get best suitable stack for all our used purposes.
protected
usedDeclarationToStack() : mixed