PDepend\Source\Language\PHP\PHPBuilder::buildInterface PHP Method

buildInterface() public method

If there is an existing class instance for the given name, this method checks if this class is part of the default namespace. If this is the case this method will update all references to the new interface and it removes the class instance. Otherwise it creates new interface instance. Where possible you should give a qualified interface name, that is prefixed with the package identifier. $builder->buildInterface('php::depend::Parser'); To determine the correct interface, this method implements the following algorithm.
  1. Check for an exactly matching instance and reuse it.
  2. Check for a interface instance that belongs to the default package. If such an instance exists, reuse it and replace the default package with the newly given package information.
  3. Check that the requested interface is in the default package, if this is true, reuse the first interface instance and ignore the default package.
  4. Create a new instance for the specified package.
public buildInterface ( string $name ) : PDepend\Source\AST\ASTInterface
$name string The interface name.
return PDepend\Source\AST\ASTInterface
    public function buildInterface($name)
    {
        $this->checkBuilderState();
        $interface = new ASTInterface($this->extractTypeName($name));
        $interface->setCache($this->cache)->setContext($this->context)->setCompilationUnit($this->defaultCompilationUnit);
        return $interface;
    }
PHPBuilder