class SwitchStatement

Properties

protected array $branchesCode
protected string $defaultCode

Methods

__construct(array $branchesCode, string $defaultCode = '')

No description

static string
generate(string $expr, array $branchesCode, string $defaultCode = '')

Create and return the source code for a switch statement

string
getSource(string $expr)

Return the source code for this switch statement

array
getValuesPerCodeBranch()

Group branches by their content and return the switch values for each branch

Details

at line 26
__construct(array $branchesCode, string $defaultCode = '')

No description

Parameters

array $branchesCode

Dictionary of [value => php code]

string $defaultCode

PHP code for the default case

at line 42
static string generate(string $expr, array $branchesCode, string $defaultCode = '')

Create and return the source code for a switch statement

Parameters

string $expr

Expression used for the switch clause

array $branchesCode

Dictionary of [value => php code]

string $defaultCode

PHP code for the default case

Return Value

string

PHP code

at line 55
protected string getSource(string $expr)

Return the source code for this switch statement

Parameters

string $expr

Expression used for the switch clause

Return Value

string

PHP code

at line 80
protected array getValuesPerCodeBranch()

Group branches by their content and return the switch values for each branch

Return Value

array