Utility: Convert a name from Pascal or camel case to lower case underscore-separated compound:
thisIsAName => this_is_a_name
static
string
convertCamelToLowerUsc
(string $name)
Utility: Convert a name from Pascal or camel case to upper case underscore-separated compound:
thisIsAName => THIS_IS_A_NAME
static
string
convertCamelToUpperUsc
(string $name)
Utility: Convert a name from upper or lower case underscore-separated compound to camel case:
THIS_IS_a_name => thisIsAName
static
string
convertUscToCamel
(string $name)
Utility: Convert a name from upper or lower case underscore-separated compound to Pascal case:
THIS_IS_a_name => ThisIsAName
static
string
convertUscToPascal
(string $name)
Utility: Create a temporary file, and return its name.
The temporary file will be deleted automatically on shutdown.
static
string
createTempFile
([string $prefix = null], [string $suffix = null])
-
string
$prefix: An optional prefix.
-
string
$suffix: An optional suffix.
Get a list of code generators.
Code generators are functions whose names start with "gen_".
static
array
getCodeGenerators
()
Generate an ID, given an index. The ID can be used by the user to choose a generator or worksheet.
static
string
getIdByIndex
(int $index)
-
int
$index: 0, 1, 2, 3, ...
Generate an index, given an ID entered by the user.
static
int
getIndexById
(string $id)
-
string
$id: a, b, c, ..., aa, ab, ac, ...
Get root directory of the PhpMyCodeGenerator installation.
static
string
getInstallationRoot
()
Prompt the user to select an option and return the selected option.
static
string
getUserSelection
(string $prompt_string, array $options, string $default_option)
-
string
$prompt_string
-
array
$options
-
string
$default_option: The return value if there is no input.
Prompt the user to select an option and return the index of the selected option.
static
string
getUserSelectionAsIndex
(string $prompt_string, array $options, [string $default_option_index = null])
-
string
$prompt_string
-
array
$options
-
string
$default_option_index: The return value if there is no input.
Get the PhpMyCodeGenerator version.
static
string
getVersion
()
Get the worksheets in an Excel.
static
array
getWorksheets
(Excel.Application $excel)
Check whether CLI PHP is used.
static
boolean
isCli
()
Check whether the operating system is Windows.
static
boolean
isOnWindows
()
Start code generation.
static
void
main
(int $argc, array $argv)
Open a spreadsheet.
static
Excel.Application
openSpreadsheet
(string $file_name)
-
string
$file_name: The file name of the spreadsheet.
Print a list of options.
static
void
printOptions
(array $options, string $selected_option)
-
array
$options
-
string
$selected_option: The pre-selected option.
Print a list of options. One option per line.
static
void
printOptionsAsLines
(array $options, [string $selected_option_index = null])
-
array
$options
-
string
$selected_option_index: The index of the pre-selected option. (optional)
Utility: Quote the value of a CSV field.
static
string
quoteCsvField
(string $value)
Try to use the prefix of a sheet name to select a code generator.
For example, if a sheet name is "mapping - tables", and there is a code generator called "gen_mapping", then "gen_mapping" will be returned.
static
string
selectDefaultCodeGeneratorBySheetName
(array $code_generators, string $sheet_name)
-
array
$code_generators
-
string
$sheet_name
Start code generation, from the web context.
static
void
webmain
(string $file_name, string $sheet_name, array $argv)
-
string
$file_name: The input file name.
-
string
$sheet_name: The input sheet name. A full sheet name consists of a code generator name and a suffix, separated by spaces and/or symbols, like "wscript - homepage". If only the suffix is given, like "homepage", the first sheet with the given suffix will be used as the input.
-
array
$argv: The arguments to the code generator.