VISU - PHP Game Framework

CommandGenerator extends GeneratorBase
in package
implements GeneratorInterface

Table of Contents

Interfaces

GeneratorInterface

Properties

$commandNamespace  : string
$commandsCtnPath  : string

Methods

appendToCtn()  : void
Updates the give code change to be appended to a ctn file.
buildChanges()  : array<string|int, CodeChange>
Build the required changes based on the given paramters
convertCamelCaseToUnderscore()  : string
convertNamespaceToServiceName()  : string
convertUndescoreToCamelCase()  : string
createBadParamterException()  : BadParameterException
createCodeGeneratorErrorException()  : CodeGeneratorErrorException
createMissingParamterException()  : BadParameterException
ensureParamter()  : mixed
Returns a paramter from the given array and throws an exception if it does not exist
evaluateParamters()  : void
Pass parameters that will be used for change generation.
findAbstractClassesInNamespace()  : array<string|int, string>
Returns an array of class names in the given namespace that are abstract definitions
fixNamespaceString()  : string
Trims the given namespace, replaces forward slashes with backwards ones etc.
generateClassBuffer()  : string
Generate class buffers
generateMultilineComment()  : string
Returns a string containing the given message as a multiline comment
getComposerJsonData()  : array<string|int, mixed>
Returns contents of the projects composer json file
getExpectedArguments()  : array<string, array<string, mixed>>
Returns expected arguments for the code generator
getPathForNamespace()  : string
Returns an absolute path for the given namespace.
getType()  : string
Returns the generators type identifier, must be unique
indentString()  : string
Indent / pad the given string
pluralizeString()  : string
pregMatchInFile()  : bool
Returns bool if the given regex matches in the given file If the file does not exist false is returned aswell.
setCommandNamespace()  : void
setPathCommandsCtn()  : void
singularizeString()  : string
splitNamespaceAndClass()  : array{: string, : string}
Splits namespace and class name from a full namespace

Properties

Methods

appendToCtn()

Updates the give code change to be appended to a ctn file.

public appendToCtn(CodeChange $change) : void

The filepath of the CodeChange is used as the target to determine offsets.

Parameters
$change : CodeChange

buildChanges()

Build the required changes based on the given paramters

public buildChanges(array<string, mixed> $parameters) : array<string|int, CodeChange>
Parameters
$parameters : array<string, mixed>
Return values
array<string|int, CodeChange>

convertCamelCaseToUnderscore()

public convertCamelCaseToUnderscore(string $string) : string
Parameters
$string : string
Return values
string

convertNamespaceToServiceName()

public convertNamespaceToServiceName(string $namespace[, string $prefix = '' ]) : string
Parameters
$namespace : string
$prefix : string = ''
Return values
string

convertUndescoreToCamelCase()

public convertUndescoreToCamelCase(string $string) : string
Parameters
$string : string
Return values
string

ensureParamter()

Returns a paramter from the given array and throws an exception if it does not exist

public ensureParamter(array<string, mixed> &$parameters, string $paramterName) : mixed
Parameters
$parameters : array<string, mixed>
$paramterName : string

evaluateParamters()

Pass parameters that will be used for change generation.

public evaluateParamters(array<string, mixed> &$parameters[, CLImate|null $cli = null ]) : void

The generator can then validate and complete them by promting the user

Parameters
$parameters : array<string, mixed>
$cli : CLImate|null = null

findAbstractClassesInNamespace()

Returns an array of class names in the given namespace that are abstract definitions

public findAbstractClassesInNamespace(string $namespace) : array<string|int, string>
Parameters
$namespace : string
Return values
array<string|int, string>

fixNamespaceString()

Trims the given namespace, replaces forward slashes with backwards ones etc.

public fixNamespaceString(string $namespace) : string

.

Parameters
$namespace : string
Return values
string

generateClassBuffer()

Generate class buffers

public generateClassBuffer(string $namespace, string $content[, array{extends?: string, implements?: string[], structType?: string, use?: string[], comment?: string} $options = [] ]) : string
Parameters
$namespace : string

The namespace including the class name

$content : string

The content buffer of the class

$options : array{extends?: string, implements?: string[], structType?: string, use?: string[], comment?: string} = []
Return values
string

generateMultilineComment()

Returns a string containing the given message as a multiline comment

public generateMultilineComment(string $comment) : string
Parameters
$comment : string
Return values
string

getComposerJsonData()

Returns contents of the projects composer json file

public getComposerJsonData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getExpectedArguments()

Returns expected arguments for the code generator

public getExpectedArguments() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

getPathForNamespace()

Returns an absolute path for the given namespace.

public getPathForNamespace(string $namespace) : string

The path is determined by matching the namespace against PSR-4 definitions in the composer json file.

Parameters
$namespace : string
Return values
string

getType()

Returns the generators type identifier, must be unique

public getType() : string
Return values
string

indentString()

Indent / pad the given string

public indentString(string $input[, int $indentLength = 4 ]) : string
Parameters
$input : string
$indentLength : int = 4
Return values
string

pluralizeString()

public pluralizeString(string $string) : string
Parameters
$string : string
Return values
string

pregMatchInFile()

Returns bool if the given regex matches in the given file If the file does not exist false is returned aswell.

public pregMatchInFile(string $filepath, string $regex) : bool
Parameters
$filepath : string
$regex : string
Return values
bool

setCommandNamespace()

public setCommandNamespace(string $namespace) : void
Parameters
$namespace : string

setPathCommandsCtn()

public setPathCommandsCtn(string $commandsCtnPath) : void
Parameters
$commandsCtnPath : string

singularizeString()

public singularizeString(string $string) : string
Parameters
$string : string
Return values
string

splitNamespaceAndClass()

Splits namespace and class name from a full namespace

public splitNamespaceAndClass(string $namespace) : array{: string, : string}
Parameters
$namespace : string
Return values
array{: string, : string}

        
On this page

Search results