class StructValue extends AbstractModel (View source)

Class StructValue stands for an enumeration value

Constants

META_DOCUMENTATION

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

MATCH_PATTERN

REPLACEMENT_PATTERN

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
static protected array $uniqueConstants Store the constants generated per structName
protected int $index The index of the value in the enumeration struct

Methods

__construct(Generator $generator, string $name, int $index, Struct $struct = null)

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 = false)

Returns the name of the value as constant

getOwner()

Returns the owner model object, meaning a Struct 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

string
getNameWithSeparatedWords(bool $keepMultipleUnderscores = false)

No description

mixed
getValue()

Returns the value with good type

int
getIndex()

Gets the index attribute value

setIndex(int $index)

Sets the index attribute value

static int
constantSuffix(string $structName, string $value, int $index)

Returns the index which has to be added at the end of natural constant name defined with the value cleaned Allows to avoid multiple constant name to be identical

Details

__construct(Generator $generator, string $name, int $index, Struct $struct = null)

Main constructor

Parameters

Generator $generator
string $name the original name
int $index the index of the value in the enumeration struct
Struct $struct defines the struct which owns this value

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

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 = false)

Returns the name of the value as constant

Parameters

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

Return Value

string

See also

AbstractModel::getCleanName()

AbstractModel getOwner()

Returns the owner model object, meaning a Struct object

Return Value

AbstractModel

See also

AbstractModel::getOwner()

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

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

string getNameWithSeparatedWords(bool $keepMultipleUnderscores = false)

Parameters

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

Return Value

string

mixed getValue()

Returns the value with good type

Return Value

mixed

int getIndex()

Gets the index attribute value

Return Value

int

StructValue setIndex(int $index)

Sets the index attribute value

Parameters

int $index

Return Value

StructValue

Exceptions

InvalidArgumentException

static protected int constantSuffix(string $structName, string $value, int $index)

Returns the index which has to be added at the end of natural constant name defined with the value cleaned Allows to avoid multiple constant name to be identical

Parameters

string $structName the struct name
string $value the value
int $index the position of the value

Return Value

int