ClassGenerator
class ClassGenerator
The ClassGenerator generates PHP classes for entries.
ClassGenerator can easily be customized by overwriting some of the protected methods. Do note, that there is not backwards
compatibility promise for override any method but getClassName.
Properties
| protected | $spaces | ||
| static protected | $classTemplate | 
Methods
ClassGenerator constructor.
Generate a class for entries of the provided ContentType.
Get the docblock for the property of the given field.
Get the docblock for the getter method for the given field.
Returns true if the type does not need any further processing.
Fields that reference links (or arrays of links) also get a method to get just the ID.
Get the class name for and entry of the provided ContentType.
Details
        at         line 41
                            
    __construct()
        
    
    ClassGenerator constructor.
Empty constructor provided for forward compatability.
        at         line 54
                            string
    generateEntryClass(ContentType $contentType)
        
    
    Generate a class for entries of the provided ContentType.
        at         line 80
                    protected        string
    generateUseStatement(ContentType $contentType)
        
    
    Generate the use statements.
        at         line 105
                    protected        string
    generateClassName(ContentType $contentType)
        
    
    Generate the class declaration
        at         line 117
                    protected        string
    generateClassBody(ContentType $contentType)
        
    
    Generate the class body.
        at         line 147
                    protected        string
    getPropertyName(ContentTypeField $field)
        
    
    Get the name of the property of the given field.
        at         line 159
                    protected        string
    getPropertyDocBlockType(ContentTypeField $field)
        
    
    Get the docblock for the property of the given field.
        at         line 175
                    protected        string
    getMethodDocBlockType(ContentTypeField $field)
        
    
    Get the docblock for the getter method for the given field.
        at         line 222
                    protected        string
    generateProperty(ContentTypeField $field)
        
    
    Generate the property of the given field.
        at         line 240
                    protected        string
    generateConstructor(ContentType $contentType)
        
    
    Generate the Constructor.
        at         line 275
                    protected        string
    generateJsonSerialize(ContentType $contentType)
        
    
    Generate the jsonSerialize function.
        at         line 377
                    protected        bool
    isSimpleType(string $type)
        
    
    Returns true if the type does not need any further processing.
        at         line 388
                    protected        string
    generateMethod(ContentTypeField $field)
        
    
    Generate the getter method for the field.
        at         line 423
                    protected        string
    generateSimpleMethodBody(ContentTypeField $field)
        
    
    Generate the getter method body in simple cases.
        at         line 444
                    protected        string
    generateLinkMethodBody(ContentTypeField $field)
        
    
    Generate the getter method body for links.
        at         line 470
                    protected        string
    generateArrayMethodBody(ContentTypeField $field)
        
    
    Generate the getter method body for arrays.
        at         line 505
                    protected        string
    generateIdMethod(ContentTypeField $field)
        
    
    Fields that reference links (or arrays of links) also get a method to get just the ID.
        at         line 562
                            string
    getClassName(ContentType $contentType)
        
    
    Get the class name for and entry of the provided ContentType.