class Struct extends AbstractModel (View source)

Class Struct stands for an available struct described in the WSDL

Constants

META_DOCUMENTATION

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

DOC_SUB_PACKAGE_STRUCTS

DOC_SUB_PACKAGE_ENUMERATIONS

DOC_SUB_PACKAGE_ARRAYS

Properties

protected Generator $generator from AbstractGeneratorAware
protected string $name Original name od the element from AbstractModel
protected string[] $meta Values associated to the operation from AbstractModel
protected string $inheritance Define the inheritance of a struct by the name of the parent struct or type from AbstractModel
protected AbstractModel $owner Store the object which owns the current model from AbstractModel
protected bool $isAbstract Indicates that the current element is an abstract element. from AbstractModel
static protected array $replacedPhpReservedKeywords Replaced keywords time in order to generate unique new keyword from AbstractModel
protected array $replacedReservedMethods Replaced methods time in order to generate unique new method from AbstractModel
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) from AbstractModel
protected StructAttribute $attributes Attributes of the struct
protected bool $isRestriction Is the struct a restriction with defined values ?
protected StructValue $values If the struct is a restriction with values, then store values
protected string[] $types If the struct is a union with types, then store types
protected bool $isStruct Defines if the current struct is a concrete struct or just a virtual struct to store meta informations
protected string $list Defines if the current struct is a list of a type or not.

Methods

__construct(Generator $generator, string $name, bool $isStruct = true, bool $isRestriction = false)

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()

No description

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()

Returns 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

bool
isArray()

Returns true if the current struct is a collection of values (like an array or a list of values)

getAttributes(bool $includeInheritanceAttributes = false, bool $requiredFirst = false)

Returns the attributes of the struct and potentially from the parent class

getAllAttributes(bool $includeInheritanceAttributes, bool $requiredFirst)

No description

addInheritanceAttributes(StructAttribute $attributes)

No description

putRequiredFirst(StructAttribute $allAttributes)

No description

int
countOwnAttributes()

Returns the number of own attributes

setAttributes(StructAttribute $structAttributeContainer)

Sets the attributes of the struct

addAttribute(string $attributeName, string $attributeType)

Adds attribute based on its original name

getAttribute(string $attributeName)

Returns the attribute by its name, otherwise null

getAttributeByCleanName(string $attributeCleanName)

Returns the attribute by its cleaned name, otherwise null

bool
isRestriction()

Returns the isRestriction value

setRestriction(bool $isRestriction = true)

Sets the isRestriction value

bool
isStruct()

Returns the isStruct value

setStruct(bool $isStruct = true)

Sets the isStruct value

string
getList()

Returns the list value

bool
isList()

Returns if the current struct is a list List are a set of basic-type values

setList(string $list = '')

Sets the list value

getValues()

Returns the values for an enumeration

setValues(StructValue $structValueContainer)

Sets the values for an enumeration

addValue(mixed $value)

Adds value to values array

getValue(string $value)

Gets the value object for the given value

Struct|null
getInheritanceStruct()

No description

string
getTopInheritance()

No description

string[]
getTypes()

No description

boolean
isUnion()

No description

setTypes(array $types)

No description

setAttributesFromSerializedJson(array $attributes)

No description

setValuesFromSerializedJson(array $values)

No description

Details

__construct(Generator $generator, string $name, bool $isStruct = true, bool $isRestriction = false)

Main constructor

Parameters

Generator $generator
string $name the original name
bool $isStruct defines if it's a real struct or not
bool $isRestriction defines if it's an enumeration or not

See also

AbstractModel::__construct()

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()

Return Value

string[]

See also

\WsdlToPhp\PackageGenerator\Model\AbstractModel::getMeta()

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()

Returns the contextual part of the class name for the package

Return Value

string

See also

AbstractModel::getContextualPart()

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

See also

AbstractModel::getDocSubPackages()

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

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

protected array toJsonSerialize()

Should return the properties of the inherited class

Return Value

array

See also

\WsdlToPhp\PackageGenerator\Model\AbstractModel::toJsonSerialize()

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

bool isArray()

Returns true if the current struct is a collection of values (like an array or a list of values)

Return Value

bool

StructAttribute getAttributes(bool $includeInheritanceAttributes = false, bool $requiredFirst = false)

Returns the attributes of the struct and potentially from the parent class

Parameters

bool $includeInheritanceAttributes include the attributes of parent class, default parent attributes are not included. If true, then the array is an associative array containing and index "attribute" for the StructAttribute object and an index "model" for the Struct object.
bool $requiredFirst places the required attributes first, then the not required in order to have the _construct method with the required attribute at first

Return Value

StructAttribute

protected StructAttribute getAllAttributes(bool $includeInheritanceAttributes, bool $requiredFirst)

Parameters

bool $includeInheritanceAttributes
bool $requiredFirst

Return Value

StructAttribute

protected addInheritanceAttributes(StructAttribute $attributes)

Parameters

StructAttribute $attributes

protected StructAttribute putRequiredFirst(StructAttribute $allAttributes)

Parameters

StructAttribute $allAttributes

Return Value

StructAttribute

int countOwnAttributes()

Returns the number of own attributes

Return Value

int

Struct setAttributes(StructAttribute $structAttributeContainer)

Sets the attributes of the struct

Parameters

StructAttribute $structAttributeContainer

Return Value

Struct

Struct addAttribute(string $attributeName, string $attributeType)

Adds attribute based on its original name

Parameters

string $attributeName the attribute name
string $attributeType the attribute type

Return Value

Struct

Exceptions

InvalidArgumentException

StructAttribute|null getAttribute(string $attributeName)

Returns the attribute by its name, otherwise null

Parameters

string $attributeName the original attribute name

Return Value

StructAttribute|null

StructAttribute|null getAttributeByCleanName(string $attributeCleanName)

Returns the attribute by its cleaned name, otherwise null

Parameters

string $attributeCleanName the cleaned attribute name

Return Value

StructAttribute|null

bool isRestriction()

Returns the isRestriction value

Return Value

bool

Struct setRestriction(bool $isRestriction = true)

Sets the isRestriction value

Parameters

bool $isRestriction

Return Value

Struct

bool isStruct()

Returns the isStruct value

Return Value

bool

Struct setStruct(bool $isStruct = true)

Sets the isStruct value

Parameters

bool $isStruct

Return Value

Struct

string getList()

Returns the list value

Return Value

string

bool isList()

Returns if the current struct is a list List are a set of basic-type values

Return Value

bool

Struct setList(string $list = '')

Sets the list value

Parameters

string $list

Return Value

Struct

StructValue getValues()

Returns the values for an enumeration

Return Value

StructValue

protected Struct setValues(StructValue $structValueContainer)

Sets the values for an enumeration

Parameters

StructValue $structValueContainer

Return Value

Struct

Struct addValue(mixed $value)

Adds value to values array

Parameters

mixed $value the original value

Return Value

Struct

StructValue|null getValue(string $value)

Gets the value object for the given value

Parameters

string $value Value name

Return Value

StructValue|null

Struct|null getInheritanceStruct()

Return Value

Struct|null

string getTopInheritance()

Return Value

string

string[] getTypes()

Return Value

string[]

boolean isUnion()

Return Value

boolean

Struct setTypes(array $types)

Parameters

array $types

Return Value

Struct

setAttributesFromSerializedJson(array $attributes)

Parameters

array $attributes

setValuesFromSerializedJson(array $values)

Parameters

array $values