PhpInterface extends AbstractPhpStruct implements GenerateableInterface, ConstantsInterface Uses ConstantsPart, InterfacesPart
Represents a PHP interface.
Tags
Interfaces, Classes and Traits
- GenerateableInterface
 - Represents all models that can be generated with a code generator.
 - ConstantsInterface
 - Interface to all php structs that can have constants.
 
Table of Contents
- $description : string
 - $constants : Map
 - $docblock : Docblock
 - $interfaces : Set
 - $longDescription : string
 - $methods : Map
 - $namespace : string
 - $requiredFiles : Set
 - $useStatements : Map
 - __construct() : mixed
 - Create a new PHP interface.
 - addInterface() : $this
 - Adds an interface.
 - addRequiredFile() : $this
 - Adds a new required file.
 - addUseStatement() : $this
 - Adds a use statement with an optional alias.
 - clearConstants() : $this
 - Clears all constants.
 - clearMethods() : $this
 - Clears all methods.
 - clearUseStatements() : $this
 - Clears all use statements.
 - create() : static
 - Creates a new struct.
 - declareUse() : string
 - 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.
 - declareUses() : $this
 - Declares multiple use statements at once.
 - generateDocblock() : $this
 - Generates a docblock from provided information.
 - getConstant() : PhpConstant
 - Returns a constant.
 - getConstantNames() : Set
 - Returns all constant names.
 - getConstants() : Map
 - Returns all constants.
 - getDescription() : string
 - Returns this description.
 - getDocblock() : Docblock
 - Returns the docblock.
 - getInterfaces() : Set
 - Returns the interfaces.
 - getLongDescription() : string
 - Returns the long description.
 - getMethod() : PhpMethod
 - Returns a method.
 - getMethodByName() : PhpMethod
 - Returns amethod.
 - getMethodNames() : Set
 - Returns all method names.
 - getMethods() : Map
 - Returns all methods.
 - getNamespace() : string
 - Returns the namespace.
 - getQualifiedName() : string
 - Returns the qualified name.
 - getRequiredFiles() : Set
 - Returns required files.
 - getUseAlias() : string
 - Returns the usable alias for a qualified name.
 - getUseStatements() : Map
 - Returns all use statements.
 - hasConstant() : bool
 - Checks whether a constant exists.
 - hasConstantByName() : bool
 - Checks whether a constant exists.
 - hasInterface() : bool
 - Checks whether an interface exists.
 - hasInterfaceByName() : bool
 - Checks whether an interface exists.
 - hasInterfaces() : bool
 - Checks whether interfaces exists.
 - hasMethod() : bool
 - Checks whether a method exists or not.
 - hasMethodByName() : bool
 - Checks whether a method exists or not.
 - hasUseStatement() : bool
 - Returns whether the given use statement is present.
 - removeConstant() : $this
 - Removes a constant.
 - removeConstantByName() : $this
 - Removes a constant.
 - removeInterface() : $this
 - Removes an interface.
 - removeInterfaceByName() : $this
 - Removes an interface.
 - removeMethod() : $this
 - Removes a method.
 - removeMethodByName() : $this
 - Removes a method.
 - removeUseStatement() : $this
 - Removes a use statement.
 - setConstant() : $this
 - Add a PhpConstant object.
 - setConstantByName() : $this
 - Create a PhpConstant instance and adds it to the constants Map.
 - setConstants() : $this
 - Sets a collection of constants.
 - setDescription() : $this
 - Sets the description, which will also be used when generating a docblock.
 - setDocblock() : $this
 - Sets the docblock.
 - setInterfaces() : $this
 - Sets a collection of interfaces.
 - setLongDescription() : $this
 - Sets the long description.
 - setMethod() : $this
 - Adds a method.
 - setMethods() : $this
 - Sets a collection of methods.
 - setMultilineDescription() : $this
 - Sets a multi-line description, which will also be used when generating a docblock.
 - setNamespace() : $this
 - Sets the namespace.
 - setQualifiedName() : $this
 - In contrast to setName(), this method accepts the fully qualified name including the namespace.
 - setRequiredFiles() : $this
 - Sets requried files.
 - setUseStatements() : $this
 - Sets use statements.
 - initConstants() : void
 - initInterfaces() : void
 
Properties
$description
    protected
        string
    $description
     = ''
        
    
$constants
    private
        Map
    $constants
    
        
    
$docblock
    private
        Docblock
    $docblock
    
        
    
$interfaces
    private
        Set
    $interfaces
    
        
    
$longDescription
    private
        string
    $longDescription
     = ''
        
    
$methods
    private
        Map
    $methods
    
        
    
$namespace
    private
        string
    $namespace
     = ''
        
    
$requiredFiles
    private
        Set
    $requiredFiles
    
        
    
$useStatements
    private
        Map
    $useStatements
    
        
    
Methods
__construct()
Create a new PHP interface.
    public
        final        __construct([string $name = '' ]) : mixed
        
        Parameters
- $name : string = ''
 - 
                    
qualified name
 
Return values
mixed —addInterface()
Adds an interface.
    public
                addInterface(PhpInterface|string $interface) : $this
        If the interface is passed as PhpInterface object, the interface is also added as use statement.
Parameters
- $interface : PhpInterface|string
 - 
                    
interface or qualified name
 
Return values
$this —addRequiredFile()
Adds a new required file.
    public
                addRequiredFile(string $file) : $this
        
        Parameters
- $file : string
 
Return values
$this —addUseStatement()
Adds a use statement with an optional alias.
    public
                addUseStatement(string $qualifiedName[, string|null $alias = null ]) : $this
        
        Parameters
- $qualifiedName : string
 - $alias : string|null = null
 
Return values
$this —clearConstants()
Clears all constants.
    public
                clearConstants() : $this
        
    
    
        Return values
$this —clearMethods()
Clears all methods.
    public
                clearMethods() : $this
        
    
    
        Return values
$this —clearUseStatements()
Clears all use statements.
    public
                clearUseStatements() : $this
        
    
    
        Return values
$this —create()
Creates a new struct.
    public
            static    create([string $name = '' ]) : static
        
        Parameters
- $name : string = ''
 - 
                    
the fqcn
 
Return values
static —declareUse()
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.
    public
                declareUse(string $qualifiedName[, string|null $alias = null ]) : string
        If the class has already been declared you get only the set alias.
Parameters
- $qualifiedName : string
 - $alias : string|null = null
 
Return values
string —the used alias
declareUses()
Declares multiple use statements at once.
    public
                declareUses() : $this
        
    
    
        Return values
$this —generateDocblock()
Generates a docblock from provided information.
    public
                generateDocblock() : $this
        
    
    
        Return values
$this —getConstant()
Returns a constant.
    public
                getConstant(string $name) : PhpConstant
        
        Parameters
- $name : string
 - 
                    
constant name
 
Tags
Return values
PhpConstant —getConstantNames()
Returns all constant names.
    public
                getConstantNames() : Set
        
    
    
        Return values
Set —getConstants()
Returns all constants.
    public
                getConstants() : Map
        
    
    
        Return values
Map —getDescription()
Returns this description.
    public
                getDescription() : string
        
    
    
        Return values
string —getDocblock()
Returns the docblock.
    public
                getDocblock() : Docblock
        
    
    
        Return values
Docblock —getInterfaces()
Returns the interfaces.
    public
                getInterfaces() : Set
        
    
    
        Return values
Set —getLongDescription()
Returns the long description.
    public
                getLongDescription() : string
        
    
    
        Return values
string —getMethod()
Returns a method.
    public
                getMethod(PhpMethod $method) : PhpMethod
        
        Parameters
- $method : PhpMethod
 
Tags
Return values
PhpMethod —getMethodByName()
Returns amethod.
    public
                getMethodByName(string $name) : PhpMethod
        
        Parameters
- $name : string
 
Tags
Return values
PhpMethod —getMethodNames()
Returns all method names.
    public
                getMethodNames() : Set
        
    
    
        Return values
Set —getMethods()
Returns all methods.
    public
                getMethods() : Map
        
    
    
        Return values
Map —collection of methods
getNamespace()
Returns the namespace.
    public
                getNamespace() : string
        
    
    
        Return values
string —getQualifiedName()
Returns the qualified name.
    public
                getQualifiedName() : string
        
    
    
        Return values
string —getRequiredFiles()
Returns required files.
    public
                getRequiredFiles() : Set
        
    
    
        Return values
Set —collection of filenames
getUseAlias()
Returns the usable alias for a qualified name.
    public
                getUseAlias(string $qualifiedName) : string
        
        Parameters
- $qualifiedName : string
 
Return values
string —the alias
getUseStatements()
Returns all use statements.
    public
                getUseStatements() : Map
        
    
    
        Return values
Map —collection of use statements
hasConstant()
Checks whether a constant exists.
    public
                hasConstant(PhpConstant $constant) : bool
        
        Parameters
- $constant : PhpConstant
 
Return values
bool —hasConstantByName()
Checks whether a constant exists.
    public
                hasConstantByName(string $name) : bool
        
        Parameters
- $name : string
 - 
                    
constant name
 
Return values
bool —hasInterface()
Checks whether an interface exists.
    public
                hasInterface(PhpInterface $interface) : bool
        
        Parameters
- $interface : PhpInterface
 
Return values
bool —hasInterfaceByName()
Checks whether an interface exists.
    public
                hasInterfaceByName(string $name) : bool
        
        Parameters
- $name : string
 - 
                    
interface name
 
Return values
bool —hasInterfaces()
Checks whether interfaces exists.
    public
                hasInterfaces() : bool
        
    
    
        Return values
bool —true if interfaces are available and false if not
hasMethod()
Checks whether a method exists or not.
    public
                hasMethod(PhpMethod $method) : bool
        
        Parameters
- $method : PhpMethod
 
Return values
bool —true if it exists and false if not
hasMethodByName()
Checks whether a method exists or not.
    public
                hasMethodByName(string $name) : bool
        
        Parameters
- $name : string
 
Return values
bool —hasUseStatement()
Returns whether the given use statement is present.
    public
                hasUseStatement(string $qualifiedName) : bool
        
        Parameters
- $qualifiedName : string
 
Return values
bool —removeConstant()
Removes a constant.
    public
                removeConstant(PhpConstant $constant) : $this
        
        Parameters
- $constant : PhpConstant
 
Tags
Return values
$this —removeConstantByName()
Removes a constant.
    public
                removeConstantByName(string $name) : $this
        
        Parameters
- $name : string
 - 
                    
constant name
 
Tags
Return values
$this —removeInterface()
Removes an interface.
    public
                removeInterface(PhpInterface $interface) : $this
        If the interface is passed as PhpInterface object, the interface is also remove from the use statements.
Parameters
- $interface : PhpInterface
 - 
                    
interface or qualified name
 
Return values
$this —removeInterfaceByName()
Removes an interface.
    public
                removeInterfaceByName(string $name) : $this
        If the interface is passed as PhpInterface object, the interface is also remove from the use statements.
Parameters
- $name : string
 - 
                    
interface qualified name
 
Return values
$this —removeMethod()
Removes a method.
    public
                removeMethod(PhpMethod $method) : $this
        
        Parameters
- $method : PhpMethod
 - 
                    
Method instance
 
Return values
$this —removeMethodByName()
Removes a method.
    public
                removeMethodByName(string $name) : $this
        
        Parameters
- $name : string
 - 
                    
method name or Method instance
 
Tags
Return values
$this —removeUseStatement()
Removes a use statement.
    public
                removeUseStatement(string $qualifiedName) : $this
        
        Parameters
- $qualifiedName : string
 
Return values
$this —setConstant()
Add a PhpConstant object.
    public
                setConstant(PhpConstant $constant) : $this
        
        Parameters
- $constant : PhpConstant
 
Return values
$this —setConstantByName()
Create a PhpConstant instance and adds it to the constants Map.
    public
                setConstantByName(string $name[, mixed $value = null ][, bool $isExpression = false ]) : $this
        
        Parameters
- $name : string
 - 
                    
constant name
 - $value : mixed = null
 - $isExpression : bool = false
 
Return values
$this —setConstants()
Sets a collection of constants.
    public
                setConstants(array<string|int, mixed>|array<string|int, PhpConstant> $constants) : $this
        
        Parameters
- $constants : array<string|int, mixed>|array<string|int, PhpConstant>
 
Return values
$this —setDescription()
Sets the description, which will also be used when generating a docblock.
    public
                setDescription(string $description) : $this
        
        Parameters
- $description : string
 
Return values
$this —setDocblock()
Sets the docblock.
    public
                setDocblock(Docblock|string $doc) : $this
        
        Parameters
- $doc : Docblock|string
 
Return values
$this —setInterfaces()
Sets a collection of interfaces.
    public
                setInterfaces(array<string|int, PhpInterface> $interfaces) : $this
        
        Parameters
- $interfaces : array<string|int, PhpInterface>
 
Return values
$this —setLongDescription()
Sets the long description.
    public
                setLongDescription(string $longDescription) : $this
        
        Parameters
- $longDescription : string
 
Return values
$this —setMethod()
Adds a method.
    public
                setMethod(PhpMethod $method) : $this
        
        Parameters
- $method : PhpMethod
 
Return values
$this —setMethods()
Sets a collection of methods.
    public
                setMethods(array<string|int, PhpMethod> $methods) : $this
        
        Parameters
- $methods : array<string|int, PhpMethod>
 
Return values
$this —setMultilineDescription()
Sets a multi-line description, which will also be used when generating a docblock.
    public
                setMultilineDescription(array<string|int, mixed> $description) : $this
        Each line is a value of the $description array.
Parameters
- $description : array<string|int, mixed>
 
Return values
$this —setNamespace()
Sets the namespace.
    public
                setNamespace(string $namespace) : $this
        
        Parameters
- $namespace : string
 
Return values
$this —setQualifiedName()
In contrast to setName(), this method accepts the fully qualified name including the namespace.
    public
                setQualifiedName(string $name) : $this
        
        Parameters
- $name : string
 
Return values
$this —setRequiredFiles()
Sets requried files.
    public
                setRequiredFiles(array<string|int, mixed> $files) : $this
        
        Parameters
- $files : array<string|int, mixed>
 
Return values
$this —setUseStatements()
Sets use statements.
    public
                setUseStatements(array<string|int, mixed> $useStatements) : $this
        
        Parameters
- $useStatements : array<string|int, mixed>
 
Tags
Return values
$this —initConstants()
    private
                initConstants() : void
    
    
    
        Return values
void —initInterfaces()
    private
                initInterfaces() : void