CommandFormatter
in package
CommandFormatter
Table of Contents
Methods
- flattenCommand() : array<string|int, mixed>
- Flatten API command's nested arrays for easier handling
- formatCommand() : string
- Format the command array into a plain text string
- getSortedCommand() : array<string, string>
- Get the sorted command array based on priority
- findPriority() : int
- Find the priority of a given key
- getPropertiesContactFieldsWithPriority() : array<string, mixed>
- Assign the priority of each key in the command array based on the key pattern
- getPropertiesPriority() : array<string, int>
- Generate the priority array with properties dynamically including contact fields and their priority
Methods
flattenCommand()
Flatten API command's nested arrays for easier handling
public
static flattenCommand(array<string|int, mixed> $cmd[, bool $toupper = true ]) : array<string|int, mixed>
Parameters
- $cmd : array<string|int, mixed>
-
API Command
- $toupper : bool = true
-
flag to convert keys to uppercase or leave as is
Return values
array<string|int, mixed>formatCommand()
Format the command array into a plain text string
public
static formatCommand(array<string, string> $command) : string
Parameters
- $command : array<string, string>
-
The command array to be formatted
Return values
string —The formatted command string
getSortedCommand()
Get the sorted command array based on priority
public
static getSortedCommand(array<string, string> $command) : array<string, string>
Parameters
- $command : array<string, string>
-
The command array to be sorted
Return values
array<string, string> —The sorted command array
findPriority()
Find the priority of a given key
private
static findPriority(string $key, array<string, int> $priority) : int
Parameters
- $key : string
-
The key to find the priority for
- $priority : array<string, int>
-
The priority array
Return values
int —The priority value
getPropertiesContactFieldsWithPriority()
Assign the priority of each key in the command array based on the key pattern
private
static getPropertiesContactFieldsWithPriority() : array<string, mixed>
Return values
array<string, mixed>getPropertiesPriority()
Generate the priority array with properties dynamically including contact fields and their priority
private
static getPropertiesPriority() : array<string, int>
Return values
array<string, int> —The priority array