/**
  * @return string
  */
 private function _compileUseStatements()
 {
     $useStatement = '';
     $thisClassname = $this->getFullyQualifiedName();
     $thisNamespace = $this->getNamespace();
     $usedClasses = array();
     if ($this->_parent) {
         if ($this->_parent instanceof ClassTemplate) {
             $usedClasses[] = $this->_parent->getFullyQualifiedName();
         } else {
             $usedClasses[] = $this->_parent;
         }
     }
     if (count($this->_interfaces) > 0) {
         foreach ($this->_interfaces as $interface) {
             if ($interface instanceof InterfaceTemplate) {
                 $usedClasses[] = $interface->getFullyQualifiedName();
             } else {
                 $usedClasses[] = $interface;
             }
         }
     }
     $usedClasses = array_count_values($usedClasses);
     ksort($usedClasses);
     foreach ($usedClasses as $usedClass => $timesImported) {
         // Don't use yourself, dog...
         if ($usedClass === $thisClassname) {
             continue;
         }
         // If this class is already in the same namespace as this one...
         $remainder = str_replace(array($thisNamespace, '\\'), '', $usedClass);
         if (basename($usedClass) === $remainder) {
             continue;
         }
         $useStatement = sprintf("%suse %s;\n", $useStatement, ltrim($usedClass, "\\"));
     }
     return $useStatement;
 }
 /**
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\ClassTemplate::setParent
  * @covers \DCarbone\PHPClassBuilder\Template\Structure\ClassTemplate::getParent
  * @depends testCanConstructWithoutArguments
  */
 public function testCanSetStringAsParent()
 {
     $child = new ClassTemplate('Child');
     $parent = '\\SplObject';
     $child->setParent($parent);
     $this->assertEquals($parent, $child->getParent());
 }
 /**
  * @param ClassTemplate $classTemplate
  */
 public function setClass(ClassTemplate $classTemplate)
 {
     $this->_class = $classTemplate;
     $this->_class->setFile($this);
 }