Handles typical client generation, override various methods for customisation 1.

copies the template. 2. looks for template directives in the code. Usually these directives indicate a block of code that must be replicated. Each directive starts with '/**ACG' and must end with * / note that services in subfolders should get a special treatment, and ideally code would be generated in them with additionnal sub-packages. This is technically too messy, so the '/' is simply replaced by '__'. This will be replaced by a '/' in Amfphp.

author Ariel Sommeria-klein
package Amfphp_Backoffice_Generators

 Methods

constructor

__construct(array $codeFileExtensions, \type $templateFolderUrl) 

Parameters

$codeFileExtensions

array

$templateFolderUrl

\type

generate project based on template

generate(array $services, string $amfphpEntryPointUrl, String $targetFolder) : null

Parameters

$services

array

. note: here '/' in each service name is replaced by '__', to avoid dealing with packages

$amfphpEntryPointUrl

string

$targetFolder

String

absolute url to folder where to put the generated code

Returns

null

override to provide a custom url for a page containing info for this generator.

getInfoUrl() : String

Returns

String

added to the url of the generated code to go to its test page directly fro, the client generator ui for example: 'testhtml'/index.html' return false if none, for example if the generated client must be compiled first

getTestUrlSuffix() 

override to provide a custom text in the Client Generator UI button for this generator.

getUiCallText() : String

Returns

String

generates code for one Service File.

generateOneServiceFileCode(String $code) : String

Parameters

$code

String

Returns

String

generate as many copies as there are services and treat it as a service block.

generateServiceFiles(String $code, \SplFileInfo $file) 

Parameters

$code

String

$file

\SplFileInfo

finds parameter blocks.

processMethodListBlock(\type $code) 

applies processParameterListBlock to each of them then multiplies and adapts the resulting code for each method

Parameters

$code

\type

multiplies and adapts the code for each parameter, but adds a comma between each

processParameterCommaListBlock(\type $code) 

Parameters

$code

\type

multiplies and adapts the code for each parameter

processParameterListBlock(\type $code) 

Parameters

$code

\type

finds method blocks.

processServiceListBlock(\type $code) 

applies processMethodListBlock to each of them then multiplies and adapts the resulting code for each service

Parameters

$code

\type

load the code, and look if either file is a service block, or il it contains service blocks.

processSourceFile(\SplFileInfo $file) 

If the file is a service block(detected by having 'SERVICE' in the file name), call generateServiceFiles If not, look for block delimited by the 'SERVICE' directive and call processServiceListBlock on them Also sets the amfphp entry point url

Parameters

$file

\SplFileInfo

looks for blocks delimited by the start and stop markers matching the directive, and applies a processing function to each found block.

searchForBlocksAndApplyProcessing(String $code, String $directive, String $functionName) : \mixed.

Parameters

$code

String

the template code. Is modified continually

$directive

String

for example 'SERVICE'

$functionName

String

functionName

Returns

\mixed.if there was a change, returns the modified code, else returns false

 Properties

 

$targetFolder : string
 

$amfphpEntryPointUrl : string
 

$codeFileExtensions : array

for example array('as')

 

$fileBeingProcessed : \SplFileInfo
 

$methodBeingProcessed : \stdClass
 

$serviceBeingProcessed : \stdClass
 

$services : array
 

$templateFolderUrl : string

 Constants

 

METHOD

METHOD 
 

PARAMETER

PARAMETER 
 

PARAMETER_COMMA

PARAMETER_COMMA 
 

SERVICE

SERVICE 
 

_METHOD_

_METHOD_ 
 

_PARAMETER_

_PARAMETER_ 
 

_SERVICE_

_SERVICE_