AbstractPhpStruct
class AbstractPhpStruct extends AbstractModel implements NamespaceInterface, DocblockInterface
Represents an abstract php structure (class, trait or interface).
Traits
Methods
Sets the description, which will also be used when generating a docblock
Sets the long description
In contrast to setName(), this method accepts the fully qualified name including the namespace.
Creates a new struct
Creates a new struct
Sets requried files
Adds a new required file
Returns required files
Sets use statements
Adds a use statement with an optional alias
Clears all use statements
Declares multiple use statements at once.
Declares a "use $fullClassName" with " as $alias" if $alias is available, and returns its alias (or not qualified classname) to be used in your actual php code.
Returns whether the given use statement is present
Returns the usable alias for a qualified name
Removes a use statement
Returns all use statements
Sets a collection of methods
Returns all methods
Returns all method names
Clears all methods
Generates a docblock from provided information
Details
in AbstractModel at line line 19
string
getDescription()
Returns this description
in AbstractModel at line line 29
$this
setDescription(string|array $description)
Sets the description, which will also be used when generating a docblock
in DocblockPart at line line 24
$this
setDocblock(Docblock|string $doc)
Sets the docblock
in DocblockPart at line line 39
Docblock
getDocblock()
Returns the docblock
in LongDescriptionPart at line line 21
string
getLongDescription()
Returns the long description
in LongDescriptionPart at line line 31
$this
setLongDescription(string $longDescription)
Sets the long description
in NamePart at line line 22
$this
setName(string $name)
Sets the name
in NamePart at line line 33
string
getName()
Returns the name
in QualifiedNamePart at line line 24
$this
setNamespace(string $namespace)
Sets the namespace
in QualifiedNamePart at line line 37
$this
setQualifiedName(string $name)
In contrast to setName(), this method accepts the fully qualified name including the namespace.
in QualifiedNamePart at line line 56
string
getNamespace()
Returns the namespace
in QualifiedNamePart at line line 65
string
getQualifiedName()
Returns the qualified name
at line line 53
static AbstractPhpStruct
create(string $name = null)
Creates a new struct
at line line 62
__construct(string $name = null)
Creates a new struct
at line line 76
$this
setRequiredFiles(array $files)
Sets requried files
at line line 88
$this
addRequiredFile(string $file)
Adds a new required file
at line line 99
Set
getRequiredFiles()
Returns required files
at line line 111
$this
setUseStatements(array $useStatements)
Sets use statements
at line line 127
$this
addUseStatement(string $qualifiedName, null|string $alias = null)
Adds a use statement with an optional alias
at line line 146
$this
clearUseStatements()
Clears all use statements
at line line 158
$this
declareUses()
Declares multiple use statements at once.
at line line 176
string
declareUse(string $qualifiedName, null|string $alias = null)
Declares a "use $fullClassName" with " as $alias" if $alias is available, and returns its alias (or not qualified classname) to be used in your actual php code.
If the class has already been declared you get only the set alias.
at line line 190
bool
hasUseStatement(string $qualifiedName)
Returns whether the given use statement is present
at line line 200
string
getUseAlias(string $qualifiedName)
Returns the usable alias for a qualified name
at line line 210
$this
removeUseStatement(string $qualifiedName)
Removes a use statement
at line line 220
Map
getUseStatements()
Returns all use statements
at line line 230
$this
setMethods(array $methods)
Sets a collection of methods
at line line 249
$this
setMethod(PhpMethod $method)
Adds a method
at line line 263
$this
removeMethod(string|PhpMethod $nameOrMethod)
Removes a method
at line line 284
bool
hasMethod(string|PhpMethod $nameOrMethod)
Checks whether a method exists or not
at line line 299
PhpMethod
getMethod(string $nameOrMethod)
Returns a method
at line line 316
Map
getMethods()
Returns all methods
at line line 325
Set
getMethodNames()
Returns all method names
at line line 334
$this
clearMethods()
Clears all methods
at line line 348
$this
generateDocblock()
Generates a docblock from provided information