Bånder

GenerateMbModels extends Command
in package

Table of Contents

Properties

$description  : string
The console command description.
$schemaDefinitions  : array<string|int, mixed>
A map to keep track of schema definitions.
$signature  : string
The name and signature of the console command.

Methods

handle()  : void
Execute the console command.
extractProperties()  : array<string|int, mixed>
Extract properties (both elements and attributes) from the schema definition.
extractElementProperties()  : void
Extracts properties from elements and attributes and adds them to the properties array.
filterInvalidProperties()  : array<string|int, mixed>
Filter out invalid properties (such as the root attribute) from the class properties.
formatAttributeName()  : string
Format attribute names to create valid PHP variable names.
formatElementName()  : string
Format the element name to create valid PHP class and file names.
generateModelClass()  : string
Generate the PHP model class content.
removeDefPrefix()  : string
Remove the 'Def' prefix from the class name.

Properties

$description

The console command description.

protected string $description = 'Generate PHP models from an XML schema (RNG)'

$schemaDefinitions

A map to keep track of schema definitions.

protected array<string|int, mixed> $schemaDefinitions = []

$signature

The name and signature of the console command.

protected string $signature = 'mbb'

Methods

extractProperties()

Extract properties (both elements and attributes) from the schema definition.

protected extractProperties(SimpleXMLElement $define[, string $context = '' ][, int $depth = 0 ]) : array<string|int, mixed>
Parameters
$define : SimpleXMLElement
$context : string = ''
$depth : int = 0
Return values
array<string|int, mixed>

extractElementProperties()

Extracts properties from elements and attributes and adds them to the properties array.

private extractElementProperties(array<string|int, mixed> &$properties, SimpleXMLElement $element, array<string|int, mixed> &$visited, int $depth) : void
Parameters
$properties : array<string|int, mixed>
$element : SimpleXMLElement
$visited : array<string|int, mixed>
$depth : int

filterInvalidProperties()

Filter out invalid properties (such as the root attribute) from the class properties.

private filterInvalidProperties(string $className, array<string|int, mixed> $properties) : array<string|int, mixed>
Parameters
$className : string
$properties : array<string|int, mixed>
Return values
array<string|int, mixed>

formatAttributeName()

Format attribute names to create valid PHP variable names.

private formatAttributeName(string $attributeName) : string
Parameters
$attributeName : string
Return values
string

formatElementName()

Format the element name to create valid PHP class and file names.

private formatElementName(string $elementName) : string
Parameters
$elementName : string
Return values
string

generateModelClass()

Generate the PHP model class content.

private generateModelClass(string $className, array<string|int, mixed> $properties, array<string|int, mixed> $schemaDefinitions) : string
Parameters
$className : string
$properties : array<string|int, mixed>
$schemaDefinitions : array<string|int, mixed>
Return values
string

removeDefPrefix()

Remove the 'Def' prefix from the class name.

private removeDefPrefix(string $className) : string
Parameters
$className : string
Return values
string

        
On this page

Search results