MethodDescriptor
extends DescriptorAbstract
in package
implements
MethodInterface, VisibilityInterface
uses
CanBeFinal, CanBeAbstract, HasVisibility, HasAttributes
Descriptor representing a Method in a Class, Interface or Trait.
Table of Contents
Interfaces
- MethodInterface
- Describes the public interface of the description for a method.
- VisibilityInterface
Properties
- $abstract : bool
- $arguments : Collection<string|int, ArgumentInterface>
- $attributes : Collection<string|int, AttributeInterface>
- $description : DescriptionDescriptor|null
- $endLocation : Location|null
- $errors : Collection<string|int, Error>
- $fileDescriptor : FileInterface|null
- $final : bool
- $fqsen : Fqsen|null
- $inheritedElement : ElementInterface|string|Fqsen|null
- $line : int
- $name : string
- $namespace : NamespaceInterface|string
- $package : PackageInterface|string
- $parent : ClassInterface|InterfaceInterface|TraitInterface|EnumInterface|null
- $startLocation : Location|null
- $static : bool
- $summary : string
- $tags : Collection<string|int, Collection<string|int, TagDescriptor>>
- $visibility : string
- $hasReturnByReference : bool
- $metadata : array<string|int, Metadata>
- $returnType : Type|null
Methods
- __call() : Collection<string|int, TagDescriptor>|null
- Dynamically constructs a set of getters to retrieve tag (collections) with.
- __construct() : mixed
- Initializes the all properties representing a collection with a new Collection object.
- __toString() : string
- Represents this object by its unique identifier, the Fully Qualified Structural Element Name.
- addArgument() : void
- getArguments() : Collection<string|int, ArgumentInterface>
- getAttributes() : Collection<string|int, AttributeInterface>
- getAuthor() : Collection<string|int, AuthorDescriptor>
- getCopyright() : Collection<string|int, TagDescriptor>
- Returns the copyrights for this element.
- getDeprecations() : array<string|int, Deprecation>
- getDescription() : DescriptionDescriptor
- Returns the description for this element.
- getEndLocation() : Location|null
- Returns the end location where the definition for this element can be found.
- getErrors() : Collection<string|int, Error>
- Returns all errors that occur in this element.
- getFile() : FileInterface
- Returns the file associated with the parent class, interface or trait.
- getFullyQualifiedStructuralElementName() : Fqsen|null
- Returns the Fully Qualified Structural Element Name (FQSEN) for this element.
- getHasReturnByReference() : bool
- getInheritedElement() : ElementInterface|string|Fqsen|null
- Returns the Method from which this method should inherit its information, if any.
- getLine() : int
- Returns the line number where the definition for this element can be found.
- getMetadata() : array<string|int, Metadata>
- getName() : string
- Returns the name for this element.
- getNamespace() : NamespaceInterface|string
- Returns the namespace for this element (defaults to global "\")
- getPackage() : PackageInterface|null
- Returns the package name for this element.
- getParam() : Collection<string|int, ParamDescriptor>
- getParent() : ClassInterface|InterfaceInterface|TraitInterface|EnumInterface|null
- Returns the parent for this descriptor.
- getPath() : string
- Returns the path to the file containing this element relative to the project's root.
- getResponse() : ReturnDescriptor
- getReturn() : Collection<string|int, ReturnDescriptor>
- getStartLocation() : Location|null
- Returns the start location where the definition for this element can be found.
- getSummary() : string
- Returns the summary which describes this element.
- getTags() : Collection<string|int, Collection<string|int, TagDescriptor>>
- Returns the tags associated with this element.
- getVersion() : Collection<string|int, VersionDescriptor>
- Returns the versions for this element.
- getVisibility() : string
- isAbstract() : bool
- isDeprecated() : bool
- Checks whether this element is deprecated.
- isFinal() : bool
- isStatic() : bool
- setArguments() : void
- setDescription() : void
- Sets a description or none to inherit from a parent.
- setHasReturnByReference() : void
- setMetadata() : void
- setParent() : void
- Sets the parent for this Descriptor.
- setReturnType() : void
- Sets return type of this method.
- setStatic() : void
- setVisibility() : void
- createDescription() : Description
- isDeprecatedByAttribute() : bool
- isDeprecatedByTag() : bool
- recurseClassInheritance() : MethodInterface|null
- recurseInterfaceInheritance() : MethodInterface|null
Properties
$abstract
protected
bool
$abstract
= false
Whether this is an abstract class.
$arguments
protected
Collection<string|int, ArgumentInterface>
$arguments
$attributes
protected
Collection<string|int, AttributeInterface>
$attributes
Attributes set on this class.
$description
protected
DescriptionDescriptor|null
$description
= null
$endLocation
protected
Location|null
$endLocation
= null
$errors
protected
Collection<string|int, Error>
$errors
A collection of errors found during filtering.
$fileDescriptor
protected
FileInterface|null
$fileDescriptor
= null
The file to which this element belongs; if applicable
$final
protected
bool
$final
= false
Whether this class is marked as final and can't be subclassed.
$fqsen
protected
Fqsen|null
$fqsen
= null
Fully Qualified Structural Element Name; the FQCN including method, property or constant name
$inheritedElement
protected
ElementInterface|string|Fqsen|null
$inheritedElement
= null
the element from which to inherit information in this element
$line
protected
int
$line
= 0
The line number on which this element occurs.
$name
protected
string
$name
= ''
$namespace
protected
NamespaceInterface|string
$namespace
= ''
The namespace for this element
$package
protected
PackageInterface|string
$package
The package with which this element is associated
$parent
protected
ClassInterface|InterfaceInterface|TraitInterface|EnumInterface|null
$parent
= null
$startLocation
protected
Location|null
$startLocation
= null
$static
protected
bool
$static
= false
$summary
protected
string
$summary
= ''
A summary describing the function of this element in short.
$tags
protected
Collection<string|int, Collection<string|int, TagDescriptor>>
$tags
The tags associated with this element.
$visibility
protected
string
$visibility
= 'public'
$hasReturnByReference
private
bool
$hasReturnByReference
= false
$metadata
private
array<string|int, Metadata>
$metadata
= []
$returnType
private
Type|null
$returnType
= null
Methods
__call()
Dynamically constructs a set of getters to retrieve tag (collections) with.
public
__call(string $name, array<string|int, mixed> $arguments) : Collection<string|int, TagDescriptor>|null
Important: __call() is not a fast method of access; it is preferred to directly use the getTags() collection. This interface is provided to allow for uniform and easy access to certain tags.
Parameters
- $name : string
- $arguments : array<string|int, mixed>
Return values
Collection<string|int, TagDescriptor>|null__construct()
Initializes the all properties representing a collection with a new Collection object.
public
__construct() : mixed
__toString()
Represents this object by its unique identifier, the Fully Qualified Structural Element Name.
public
__toString() : string
Return values
stringaddArgument()
public
addArgument(string $name, ArgumentInterface $argument) : void
Parameters
- $name : string
- $argument : ArgumentInterface
getArguments()
public
getArguments() : Collection<string|int, ArgumentInterface>
Return values
Collection<string|int, ArgumentInterface>getAttributes()
public
getAttributes() : Collection<string|int, AttributeInterface>
Return values
Collection<string|int, AttributeInterface>getAuthor()
public
getAuthor() : Collection<string|int, AuthorDescriptor>
Return values
Collection<string|int, AuthorDescriptor>getCopyright()
Returns the copyrights for this element.
public
getCopyright() : Collection<string|int, TagDescriptor>
Return values
Collection<string|int, TagDescriptor>getDeprecations()
public
getDeprecations() : array<string|int, Deprecation>
Return values
array<string|int, Deprecation>getDescription()
Returns the description for this element.
public
getDescription() : DescriptionDescriptor
This method will automatically attempt to inherit the parent's description if this one has none.
Return values
DescriptionDescriptorgetEndLocation()
Returns the end location where the definition for this element can be found.
public
getEndLocation() : Location|null
Return values
Location|nullgetErrors()
Returns all errors that occur in this element.
public
getErrors() : Collection<string|int, Error>
Return values
Collection<string|int, Error>getFile()
Returns the file associated with the parent class, interface or trait.
public
getFile() : FileInterface
Return values
FileInterfacegetFullyQualifiedStructuralElementName()
Returns the Fully Qualified Structural Element Name (FQSEN) for this element.
public
getFullyQualifiedStructuralElementName() : Fqsen|null
Return values
Fqsen|nullgetHasReturnByReference()
public
getHasReturnByReference() : bool
Return values
boolgetInheritedElement()
Returns the Method from which this method should inherit its information, if any.
public
getInheritedElement() : ElementInterface|string|Fqsen|null
The inheritance scheme for a method is more complicated than for most elements; the following business rules apply:
- if the parent class/interface extends another class or other interfaces (interfaces have multiple
inheritance!) then:
- Check each parent class/interface's parent if they have a method with the exact same name
- if a method is found with the same name; return the first one encountered.
- if the parent is a class and implements interfaces, check each interface for a method with the exact same name. If such a method is found, return the first hit.
Return values
ElementInterface|string|Fqsen|nullgetLine()
Returns the line number where the definition for this element can be found.
public
getLine() : int
use getStartLocation()->getLineNumber() instead
Return values
intgetMetadata()
public
getMetadata() : array<string|int, Metadata>
Return values
array<string|int, Metadata>getName()
Returns the name for this element.
public
getName() : string
Return values
stringgetNamespace()
Returns the namespace for this element (defaults to global "\")
public
getNamespace() : NamespaceInterface|string
Return values
NamespaceInterface|stringgetPackage()
Returns the package name for this element.
public
getPackage() : PackageInterface|null
Return values
PackageInterface|nullgetParam()
public
getParam() : Collection<string|int, ParamDescriptor>
Return values
Collection<string|int, ParamDescriptor>getParent()
Returns the parent for this descriptor.
public
getParent() : ClassInterface|InterfaceInterface|TraitInterface|EnumInterface|null
Return values
ClassInterface|InterfaceInterface|TraitInterface|EnumInterface|nullgetPath()
Returns the path to the file containing this element relative to the project's root.
public
getPath() : string
Return values
stringgetResponse()
public
getResponse() : ReturnDescriptor
Return values
ReturnDescriptorgetReturn()
public
getReturn() : Collection<string|int, ReturnDescriptor>
Return values
Collection<string|int, ReturnDescriptor>getStartLocation()
Returns the start location where the definition for this element can be found.
public
getStartLocation() : Location|null
Return values
Location|nullgetSummary()
Returns the summary which describes this element.
public
getSummary() : string
This method will automatically attempt to inherit the parent's summary if this one has none.
Return values
stringgetTags()
Returns the tags associated with this element.
public
getTags() : Collection<string|int, Collection<string|int, TagDescriptor>>
Return values
Collection<string|int, Collection<string|int, TagDescriptor>>getVersion()
Returns the versions for this element.
public
getVersion() : Collection<string|int, VersionDescriptor>
Return values
Collection<string|int, VersionDescriptor>getVisibility()
public
getVisibility() : string
Return values
stringisAbstract()
public
isAbstract() : bool
Return values
boolisDeprecated()
Checks whether this element is deprecated.
public
isDeprecated() : bool
Return values
boolisFinal()
public
isFinal() : bool
Return values
boolisStatic()
public
isStatic() : bool
Return values
boolsetArguments()
public
setArguments(Collection<string|int, ArgumentInterface> $arguments) : void
Parameters
- $arguments : Collection<string|int, ArgumentInterface>
setDescription()
Sets a description or none to inherit from a parent.
public
setDescription(DescriptionDescriptor|null $description) : void
Parameters
- $description : DescriptionDescriptor|null
setHasReturnByReference()
public
setHasReturnByReference(bool $hasReturnByReference) : void
Parameters
- $hasReturnByReference : bool
setMetadata()
public
setMetadata(array<string|int, Metadata> $metadata) : void
Parameters
- $metadata : array<string|int, Metadata>
setParent()
Sets the parent for this Descriptor.
public
setParent(mixed $parent) : void
Parameters
- $parent : mixed
setReturnType()
Sets return type of this method.
public
setReturnType(Type $returnType) : void
Parameters
- $returnType : Type
setStatic()
public
setStatic(bool $static) : void
Parameters
- $static : bool
setVisibility()
public
setVisibility(string $visibility) : void
Parameters
- $visibility : string
createDescription()
private
createDescription(string|null $param) : Description
Parameters
- $param : string|null
Return values
DescriptionisDeprecatedByAttribute()
private
isDeprecatedByAttribute() : bool
Tags
Return values
boolisDeprecatedByTag()
private
isDeprecatedByTag() : bool
Return values
boolrecurseClassInheritance()
private
recurseClassInheritance(ClassInterface $currentClass) : MethodInterface|null
Parameters
- $currentClass : ClassInterface
Return values
MethodInterface|nullrecurseInterfaceInheritance()
private
recurseInterfaceInheritance(InterfaceInterface $currentInterface) : MethodInterface|null
Parameters
- $currentInterface : InterfaceInterface