VISU - PHP Game Framework

GeneratorBase
in package

Table of Contents

Properties

$infelctorIrregular  : array<string, string>
$infelctorPlural  : array<string, string>
$infelctorSingular  : array<string, string>
$infelctorUncountable  : array<string|int, string>

Methods

appendToCtn()  : void
Updates the give code change to be appended to a ctn file.
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
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
getPathForNamespace()  : string
Returns an absolute path for the given namespace.
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.
singularizeString()  : string
splitNamespaceAndClass()  : array{: string, : string}
Splits namespace and class name from a full namespace

Properties

$infelctorIrregular

private static array<string, string> $infelctorIrregular = ['move' => 'moves', 'foot' => 'feet', 'goose' => 'geese', 'sex' => 'sexes', 'child' => 'children', 'man' => 'men', 'tooth' => 'teeth', 'person' => 'people', 'valve' => 'valves']

$infelctorPlural

private static array<string, string> $infelctorPlural = ['/(quiz)$/i' => "\$1zes", '/^(ox)$/i' => "\$1en", '/([m|l])ouse$/i' => "\$1ice", '/(matr|vert|ind)ix|ex$/i' => "\$1ices", '/(x|ch|ss|sh)$/i' => "\$1es", '/([^aeiouy]|qu)y$/i' => "\$1ies", '/(hive)$/i' => "\$1s", '/(?:([^f])fe|([lr])f)$/i' => "\$1\$2ves", '/(shea|lea|loa|thie)f$/i' => "\$1ves", '/sis$/i' => "ses", '/([ti])um$/i' => "\$1a", '/(tomat|potat|ech|her|vet)o$/i' => "\$1oes", '/(bu)s$/i' => "\$1ses", '/(alias)$/i' => "\$1es", '/(octop)us$/i' => "\$1i", '/(ax|test)is$/i' => "\$1es", '/(us)$/i' => "\$1es", '/s$/i' => "s", '/$/' => "s"]

$infelctorSingular

private static array<string, string> $infelctorSingular = ['/(quiz)zes$/i' => "\$1", '/(matr)ices$/i' => "\$1ix", '/(vert|ind)ices$/i' => "\$1ex", '/^(ox)en$/i' => "\$1", '/(alias)es$/i' => "\$1", '/(octop|vir)i$/i' => "\$1us", '/(cris|ax|test)es$/i' => "\$1is", '/(shoe)s$/i' => "\$1", '/(o)es$/i' => "\$1", '/(bus)es$/i' => "\$1", '/([m|l])ice$/i' => "\$1ouse", '/(x|ch|ss|sh)es$/i' => "\$1", '/(m)ovies$/i' => "\$1ovie", '/(s)eries$/i' => "\$1eries", '/([^aeiouy]|qu)ies$/i' => "\$1y", '/([lr])ves$/i' => "\$1f", '/(tive)s$/i' => "\$1", '/(hive)s$/i' => "\$1", '/(li|wi|kni)ves$/i' => "\$1fe", '/(shea|loa|lea|thie)ves$/i' => "\$1f", '/(^analy)ses$/i' => "\$1sis", '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => "\$1\$2sis", '/([ti])a$/i' => "\$1um", '/(n)ews$/i' => "\$1ews", '/(h|bl)ouses$/i' => "\$1ouse", '/(corpse)s$/i' => "\$1", '/(us)es$/i' => "\$1", '/s$/i' => ""]

$infelctorUncountable

private static array<string|int, string> $infelctorUncountable = ['sheep', 'fish', 'deer', 'series', 'species', 'money', 'rice', 'information', 'equipment']

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

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

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>

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

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

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