/**
  * Adds an interface.
  *
  * If the interface is passed as PhpInterface object,
  * the interface is also added as use statement.
  *
  * @param PhpInterface|string $interface interface or qualified name
  * @return $this
  */
 public function addInterface($interface)
 {
     if ($interface instanceof PhpInterface) {
         $name = $interface->getName();
         $qname = $interface->getQualifiedName();
         $namespace = $interface->getNamespace();
         if ($namespace != $this->getNamespace()) {
             $this->addUseStatement($qname);
         }
     } else {
         $name = $interface;
     }
     $this->interfaces->add($name);
     return $this;
 }