PHP SDK by CNIC

CommandFormatter
in package

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
getPriorityArray()  : array<string, int>
Get the priority array with regex patterns

Methods

flattenCommand()

Flatten API command's nested arrays for easier handling

public static flattenCommand(array<string|int, mixed> $cmd) : array<string|int, mixed>
Parameters
$cmd : array<string|int, mixed>

API Command

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

getPriorityArray()

Get the priority array with regex patterns

private static getPriorityArray() : array<string, int>
Return values
array<string, int>

The priority array


        
On this page

Search results