class AbstractModel extends AbstractGeneratorAware implements JsonSerializable (View source)

Class AbstractModel defines the basic properties and methods to operations and structs extracted from the WSDL

Constants

META_DOCUMENTATION

Constant used to define the key to store documentation value in meta

Properties

protected Generator $generator from AbstractGeneratorAware
protected string $name Original name od the element
protected string[] $meta Values associated to the operation
protected string $inheritance Define the inheritance of a struct by the name of the parent struct or type
protected AbstractModel $owner Store the object which owns the current model
protected bool $isAbstract Indicates that the current element is an abstract element.
static protected array $replacedPhpReservedKeywords Replaced keywords time in order to generate unique new keyword
protected array $replacedReservedMethods Replaced methods time in order to generate unique new method
static protected array $uniqueNames Unique name generated in order to ensure unique naming (for struct constructor and setters/getters even for different case attribute name with same value)

Methods

__construct(Generator $generator, string $name)

Main constructor

string
getExtendsClassName()

No description

string
getInheritance()

Returns the name of the class the current class inherits from

setInheritance(string $inheritance = '')

Sets the name of the class the current class inherits from

getInheritedModel()

No description

string[]
getMeta()

Returns the meta

setMeta(array $meta = [])

Sets the meta

addMeta(string $metaName, mixed $metaValue)

Add meta information to the operation

array
mergeMeta()

Allows to merge meta from different sources and ensure consistency of their order Must be passed as less important (at first position) to most important (last position)

setDocumentation(string $documentation)

Sets the documentation meta value.

mixed
getMetaValue(string $metaName, mixed $fallback = null)

Returns a meta value according to its name

mixed
getMetaValueFirstSet(array $names, mixed $fallback = null)

Returns the value of the first meta value assigned to the name

string
getName()

Returns the original name extracted from the WSDL

setName(string $name)

Sets the original name extracted from the WSDL

string
getCleanName(bool $keepMultipleUnderscores = true)

Returns a valid clean name for PHP

getOwner()

Returns the owner model object

setOwner(AbstractModel $owner = null)

Sets the owner model object

bool
isAbstract()

No description

setAbstract(bool $isAbstract)

No description

bool
nameIsClean()

Returns true if the original name is safe to use as a PHP property, variable name or class name

string
getPackagedName(bool $namespaced = false)

Returns the packaged name

string
getContextualPart()

Allows to define the contextual part of the class name for the package

string|null
getExtends(bool $short = false)

Allows to define from which class the current model extends

string
getNamespace()

No description

string
getSubDirectory()

Returns directory where to store class and create it if needed

array
getDocSubPackages()

Returns the sub package name which the model belongs to Must be overridden by sub classes

static string
cleanString(string $string, bool $keepMultipleUnderscores = true)

Clean a string to make it valid as PHP variable

static string
replacePhpReservedKeyword(string $keyword, string $context = null)

Returns a usable keyword for a original keyword

getReservedMethodsInstance($filename = null)

No description

string
replaceReservedMethod(string $methodName, string $context = null)

Returns a usable method for a original method

static string
uniqueName(string $name, string $context)

Static method which returns a unique name case sensitively Useful to name methods case sensitively distinct, see http://the-echoplex.net/log/php-case-sensitivity

static 
purgeUniqueNames()

Gives the availability for test purpose and multiple package generation to purge unique names

static 
purgePhpReservedKeywords()

Gives the availability for test purpose and multiple package generation to purge reserved keywords usage

array
toJsonSerialize()

Should return the properties of the inherited class

jsonSerialize()

{@inheritDoc}

static AbstractModel
instanceFromSerializedJson(Generator $generator, array $args)

No description

static 
checkSerializedJson(array $args)

No description

Details

__construct(Generator $generator, string $name)

Main constructor

Parameters

Generator $generator
string $name the original name

protected AbstractGeneratorAware setGenerator(Generator $generator)

Parameters

Generator $generator

Return Value

AbstractGeneratorAware

Generator getGenerator()

Return Value

Generator

string getExtendsClassName()

Return Value

string

string getInheritance()

Returns the name of the class the current class inherits from

Return Value

string

AbstractModel setInheritance(string $inheritance = '')

Sets the name of the class the current class inherits from

Parameters

string $inheritance

Return Value

AbstractModel

Struct getInheritedModel()

Return Value

Struct

string[] getMeta()

Returns the meta

Return Value

string[]

AbstractModel setMeta(array $meta = [])

Sets the meta

Parameters

array $meta

Return Value

AbstractModel

AbstractModel addMeta(string $metaName, mixed $metaValue)

Add meta information to the operation

Parameters

string $metaName
mixed $metaValue

Return Value

AbstractModel

Exceptions

InvalidArgumentException

protected array mergeMeta()

Allows to merge meta from different sources and ensure consistency of their order Must be passed as less important (at first position) to most important (last position)

Return Value

array

AbstractModel setDocumentation(string $documentation)

Sets the documentation meta value.

Documentation is set as an array so if multiple documentation nodes are set for an unique element, it will gather them.

Parameters

string $documentation the documentation from the WSDL

Return Value

AbstractModel

mixed getMetaValue(string $metaName, mixed $fallback = null)

Returns a meta value according to its name

Parameters

string $metaName the meta information name
mixed $fallback the fallback value if unset

Return Value

mixed the meta information value

mixed getMetaValueFirstSet(array $names, mixed $fallback = null)

Returns the value of the first meta value assigned to the name

Parameters

array $names the meta names to check
mixed $fallback the fallback value if anyone is set

Return Value

mixed the meta information value

string getName()

Returns the original name extracted from the WSDL

Return Value

string

AbstractModel setName(string $name)

Sets the original name extracted from the WSDL

Parameters

string $name

Return Value

AbstractModel

string getCleanName(bool $keepMultipleUnderscores = true)

Returns a valid clean name for PHP

Parameters

bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores

Return Value

string

AbstractModel getOwner()

Returns the owner model object

Return Value

AbstractModel

AbstractModel setOwner(AbstractModel $owner = null)

Sets the owner model object

Parameters

AbstractModel $owner object the owner of the current model

Return Value

AbstractModel

bool isAbstract()

Return Value

bool

AbstractModel setAbstract(bool $isAbstract)

Parameters

bool $isAbstract

Return Value

AbstractModel

bool nameIsClean()

Returns true if the original name is safe to use as a PHP property, variable name or class name

Return Value

bool

string getPackagedName(bool $namespaced = false)

Returns the packaged name

Parameters

bool $namespaced

Return Value

string

string getContextualPart()

Allows to define the contextual part of the class name for the package

Return Value

string

string|null getExtends(bool $short = false)

Allows to define from which class the current model extends

Parameters

bool $short

Return Value

string|null

string getNamespace()

Return Value

string

string getSubDirectory()

Returns directory where to store class and create it if needed

Return Value

string

array getDocSubPackages()

Returns the sub package name which the model belongs to Must be overridden by sub classes

Return Value

array

static string cleanString(string $string, bool $keepMultipleUnderscores = true)

Clean a string to make it valid as PHP variable

Parameters

string $string the string to clean
bool $keepMultipleUnderscores optional, allows to keep the multiple consecutive underscores

Return Value

string

static string replacePhpReservedKeyword(string $keyword, string $context = null)

Returns a usable keyword for a original keyword

Parameters

string $keyword the keyword
string $context the context

Return Value

string

AbstractReservedWord getReservedMethodsInstance($filename = null)

Parameters

$filename

Return Value

AbstractReservedWord

Exceptions

InvalidArgumentException

string replaceReservedMethod(string $methodName, string $context = null)

Returns a usable method for a original method

Parameters

string $methodName the method name
string $context the context

Return Value

string

static protected string uniqueName(string $name, string $context)

Static method which returns a unique name case sensitively Useful to name methods case sensitively distinct, see http://the-echoplex.net/log/php-case-sensitivity

Parameters

string $name the original name
string $context the context where the name is needed unique

Return Value

string

static purgeUniqueNames()

Gives the availability for test purpose and multiple package generation to purge unique names

static purgePhpReservedKeywords()

Gives the availability for test purpose and multiple package generation to purge reserved keywords usage

abstract protected array toJsonSerialize()

Should return the properties of the inherited class

Return Value

array

jsonSerialize()

{@inheritDoc}

See also

JsonSerializable::jsonSerialize()

static AbstractModel instanceFromSerializedJson(Generator $generator, array $args)

Parameters

Generator $generator
array $args

Return Value

AbstractModel

static protected checkSerializedJson(array $args)

Parameters

array $args

Exceptions

InvalidArgumentException