class Method extends AbstractModel (View source)

Class Method stands for an available operation described in 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 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 string $parameterType Type of the parameter for the operation
protected string $returnType Type of the return value for the operation
protected bool $isUnique Indicates function is not alone with this name, then its name is contextualized based on its parameter(s)
protected string $methodName Generated method name stored as soon as it has been defined once

Methods

__construct(Generator $generator, string $name, string|array $parameterType = '', string|array $returnType = '', Service $service = null, bool $isUnique = true)

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)

Method name can't starts with numbers

getOwner()

Returns the owner model object, meaning a Service 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
getMethodName()

Returns the name of the method that is used to call the operation It takes care of the fact that the method might not be the only one named as it is.

string|string[]
getParameterType()

Returns the parameter type

setParameterType(string|string[] $parameterType)

Set the parameter type

string
getReturnType()

Returns the return type

setReturnType(string|string[] $returnType)

Set the return type

bool
isUnique()

Returns the isUnique property

setUnique(bool $isUnique)

Set the isUnique property

Details

__construct(Generator $generator, string $name, string|array $parameterType = '', string|array $returnType = '', Service $service = null, bool $isUnique = true)

Main constructor

Parameters

Generator $generator
string $name the original name
string|array $parameterType the type/name of the parameter
string|array $returnType the type/name of the return value
Service $service defines the struct which owns this value
bool $isUnique defines if the method is unique 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()

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)

Method name can't starts with numbers

Parameters

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

Return Value

string

See also

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

AbstractModel getOwner()

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

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

Returns the name of the method that is used to call the operation It takes care of the fact that the method might not be the only one named as it is.

Return Value

string

string|string[] getParameterType()

Returns the parameter type

Return Value

string|string[]

Method setParameterType(string|string[] $parameterType)

Set the parameter type

Parameters

string|string[] $parameterType

Return Value

Method

string getReturnType()

Returns the return type

Return Value

string

Method setReturnType(string|string[] $returnType)

Set the return type

Parameters

string|string[] $returnType

Return Value

Method

bool isUnique()

Returns the isUnique property

Return Value

bool

Method setUnique(bool $isUnique)

Set the isUnique property

Parameters

bool $isUnique

Return Value

Method