Class PhpMyCodeGenerator

Description

The bootstrap class of PhpMyCodeGenerator.

Call PhpMyCodeGenerator::main or PhpMyCodeGenerator::webmain to start code generation.

Located in /PhpMyCodeGenerator.php (line 7)


	
			
Class Constant Summary
Method Summary
static string convertCamelToLowerUsc (string $name)
static string convertCamelToUpperUsc (string $name)
static string convertUscToCamel (string $name)
static string convertUscToPascal (string $name)
static string createTempFile ([string $prefix = null], [string $suffix = null])
static array getCodeGenerators ()
static string getIdByIndex (int $index)
static int getIndexById (string $id)
static string getInstallationRoot ()
static string getUserSelection (string $prompt_string, array $options, string $default_option)
static string getUserSelectionAsIndex (string $prompt_string, array $options, [string $default_option_index = null])
static string getVersion ()
static array getWorksheets (Excel.Application $excel)
static boolean isCli ()
static boolean isOnWindows ()
static void main (int $argc, array $argv)
static Excel.Application openSpreadsheet (string $file_name)
static void printOptions (array $options, string $selected_option)
static void printOptionsAsLines (array $options, [string $selected_option_index = null])
static string quoteCsvField (string $value)
static string selectDefaultCodeGeneratorBySheetName (array $code_generators, string $sheet_name)
static void webmain (string $file_name, string $sheet_name, array $argv)
Methods
static method convertCamelToLowerUsc (line 348)

Utility: Convert a name from Pascal or camel case to lower case underscore-separated compound:

thisIsAName => this_is_a_name

  • return: The name as a lower case underscore-separated compound.
  • access: public
static string convertCamelToLowerUsc (string $name)
  • string $name
static method convertCamelToUpperUsc (line 360)

Utility: Convert a name from Pascal or camel case to upper case underscore-separated compound:

thisIsAName => THIS_IS_A_NAME

  • return: The name as an upper case underscore-separated compound.
  • access: public
static string convertCamelToUpperUsc (string $name)
  • string $name
static method convertUscToCamel (line 338)

Utility: Convert a name from upper or lower case underscore-separated compound to camel case:

THIS_IS_a_name => thisIsAName

  • return: The name in camel case.
  • access: public
static string convertUscToCamel (string $name)
  • string $name
static method convertUscToPascal (line 328)

Utility: Convert a name from upper or lower case underscore-separated compound to Pascal case:

THIS_IS_a_name => ThisIsAName

  • return: The name in Pascal case.
  • access: public
static string convertUscToPascal (string $name)
  • string $name
static method createTempFile (line 380)

Utility: Create a temporary file, and return its name.

The temporary file will be deleted automatically on shutdown.

  • return: The name of a temporary file.
  • access: public
static string createTempFile ([string $prefix = null], [string $suffix = null])
  • string $prefix: An optional prefix.
  • string $suffix: An optional suffix.
static method getCodeGenerators (line 173)

Get a list of code generators.

Code generators are functions whose names start with "gen_".

  • return: an array of function names for the code generators.
  • access: public
static array getCodeGenerators ()
static method getIdByIndex (line 218)

Generate an ID, given an index. The ID can be used by the user to choose a generator or worksheet.

  • return: a for 0, b for 1, c for 2, ..., aa for 26, ab for 27, ...
  • access: public
static string getIdByIndex (int $index)
  • int $index: 0, 1, 2, 3, ...
static method getIndexById (line 232)

Generate an index, given an ID entered by the user.

  • return: 0 for a, 1 for b, 2 for c, ..., 26 for aa, 27 for ab, ..., -1 for invalid ID.
  • access: public
static int getIndexById (string $id)
  • string $id: a, b, c, ..., aa, ab, ac, ...
static method getInstallationRoot (line 434)

Get root directory of the PhpMyCodeGenerator installation.

  • return: The root directory.
  • access: public
static string getInstallationRoot ()
static method getUserSelection (line 275)

Prompt the user to select an option and return the selected option.

  • return: the selected option, or the default option if no input.
  • access: public
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.
static method getUserSelectionAsIndex (line 302)

Prompt the user to select an option and return the index of the selected option.

  • return: the index of the selected option, or the index of the default option if no input.
  • access: public
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.
static method getVersion (line 425)

Get the PhpMyCodeGenerator version.

  • return: The version.
  • access: public
static string getVersion ()
static method getWorksheets (line 189)

Get the worksheets in an Excel.

  • return: an array of names for the worksheets.
  • access: public
static array getWorksheets (Excel.Application $excel)
  • Excel.Application $excel
static method isCli (line 417)

Check whether CLI PHP is used.

  • return: true/false
  • access: public
static boolean isCli ()
static method isOnWindows (line 409)

Check whether the operating system is Windows.

  • return: true/false
  • access: public
static boolean isOnWindows ()
static method main (line 16)

Start code generation.

  • access: public
static void main (int $argc, array $argv)
  • int $argc
  • array $argv
static method openSpreadsheet (line 139)

Open a spreadsheet.

  • return: an Excel.Application-like object.
  • access: public
static Excel.Application openSpreadsheet (string $file_name)
  • string $file_name: The file name of the spreadsheet.
static method printOptions (line 249)

Print a list of options.

  • access: public
static void printOptions (array $options, string $selected_option)
  • array $options
  • string $selected_option: The pre-selected option.
static method printOptionsAsLines (line 262)

Print a list of options. One option per line.

  • access: public
static void printOptionsAsLines (array $options, [string $selected_option_index = null])
  • array $options
  • string $selected_option_index: The index of the pre-selected option. (optional)
static method quoteCsvField (line 369)

Utility: Quote the value of a CSV field.

  • return: The quoted value.
  • access: public
static string quoteCsvField (string $value)
  • string $value
static method selectDefaultCodeGeneratorBySheetName (line 204)

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.

  • return: the name of a code generator, or null if there is no default.
  • access: public
static string selectDefaultCodeGeneratorBySheetName (array $code_generators, string $sheet_name)
  • array $code_generators
  • string $sheet_name
static method webmain (line 102)

Start code generation, from the web context.

  • access: public
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.
Class Constants
version = 2 (line 8)
version_minor = 13 (line 9)

Documentation generated on Sun, 01 Mar 2015 08:43:49 +0000 by phpDocumentor 1.4.3