Class Amfphp_BackOffice_ClientGenerator_ClientGeneratorBase

Description

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

Located in /BackOffice/ClientGenerator/ClientGeneratorBase.php (line 26)


	
			
Direct descendents
Class Description
AmfphpFlashClientGenerator generates a Flash project for consumption of amfPHP services
AmfphpHtmlClientGenerator generates a Flash project for consumption of amfPHP services
Class Constant Summary
 METHOD = 'METHOD'
 PARAMETER = 'PARAMETER'
 PARAMETER_COMMA = 'PARAMETER_COMMA'
 SERVICE = 'SERVICE'
 _METHOD_ = '_METHOD_'
 _PARAMETER_ = '_PARAMETER_'
 _SERVICE_ = '_SERVICE_'
Variable Summary
Method Summary
Amfphp_BackOffice_ClientGenerator_ClientGeneratorBase __construct ( $codeFileExtensions, type $templateFolderUrl)
string generate (array $services, string $amfphpEntryPointUrl)
String generateOneServiceFileCode (String $code)
void generateServiceFiles (String $code,  $file)
String getInfoUrl ()
String getUiCallText ()
void processMethodListBlock (type $code)
void processParameterCommaListBlock (type $code)
void processParameterListBlock (type $code)
void processServiceListBlock (type $code)
void processSourceFile ( $file)
mixed. searchForBlocksAndApplyProcessing (String $code, String $directive, String $functionName)
Variables
mixed $amfphpEntryPointUrl (line 38)
  • access: protected
mixed $codeFileExtensions (line 28)
  • access: protected
SplFileInfo $fileBeingProcessed (line 37)

file being processed, useful for error messages

  • access: protected
mixed $methodBeingProcessed (line 32)
  • access: protected
mixed $serviceBeingProcessed (line 31)
  • access: protected
mixed $services (line 30)
  • access: protected
mixed $templateFolderUrl (line 29)
  • access: protected
Methods
Constructor __construct (line 55)
  • access: public
Amfphp_BackOffice_ClientGenerator_ClientGeneratorBase __construct ( $codeFileExtensions, type $templateFolderUrl)
  • array $codeFileExtensions
  • type $templateFolderUrl

Redefined in descendants as:
generate (line 93)
  • return: folder where the data was written
  • access: public
string generate (array $services, string $amfphpEntryPointUrl)
  • array $services: . note: here '/' in each service name must be replaced by '__', to avoid dealing with packages
  • string $amfphpEntryPointUrl
generateOneServiceFileCode (line 214)

generates code for one Service File.

  • access: protected
String generateOneServiceFileCode (String $code)
  • String $code
generateServiceFiles (line 198)

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

  • access: protected
void generateServiceFiles (String $code,  $file)
  • String $code
  • SplFileInfo $file
getInfoUrl (line 73)

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

  • access: public
String getInfoUrl ()

Redefined in descendants as:
getTestUrlSuffix (line 83)

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 exqmple if the generated client must be compiled first

  • access: public
void getTestUrlSuffix ()

Redefined in descendants as:
getUiCallText (line 66)

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

  • access: public
String getUiCallText ()

Redefined in descendants as:
processMethodListBlock (line 253)

finds parameter blocks.

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

  • access: protected
void processMethodListBlock (type $code)
  • type $code
processParameterCommaListBlock (line 289)

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

  • access: protected
void processParameterCommaListBlock (type $code)
  • type $code
processParameterListBlock (line 276)

multiplies and adapts the code for each parameter

  • access: protected
void processParameterListBlock (type $code)
  • type $code
processServiceListBlock (line 230)

finds method blocks.

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

  • access: protected
void processServiceListBlock (type $code)
  • type $code
processSourceFile (line 174)

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

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

  • access: protected
void processSourceFile ( $file)
  • SplFileInfo $file
searchForBlocksAndApplyProcessing (line 118)

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

  • return: if there was a change, returns the modified code, else returns false
  • access: protected
mixed. searchForBlocksAndApplyProcessing (String $code, String $directive, String $functionName)
  • String $code: the template code. Is modified continually
  • String $directive: for example 'SERVICE'
  • String $functionName: functionName
Class Constants
METHOD = 'METHOD' (line 46)
PARAMETER = 'PARAMETER' (line 47)
PARAMETER_COMMA = 'PARAMETER_COMMA' (line 48)
SERVICE = 'SERVICE' (line 45)
_METHOD_ = '_METHOD_' (line 42)
_PARAMETER_ = '_PARAMETER_' (line 43)
_SERVICE_ = '_SERVICE_' (line 41)

Documentation generated on Tue, 29 May 2012 23:42:02 +0200 by phpDocumentor 1.4.3