/** * Visits a class node. * * @param PHP_Depend_Code_Class $class The current class node. * * @return void * @see PHP_Depend_VisitorI::visitClass() */ public function visitClass(PHP_Depend_Code_Class $class) { if (!$class->isUserDefined()) { return; } $doc = $this->packages->ownerDocument; $classXml = $doc->createElement('Class'); $classXml->setAttribute('sourceFile', (string) $class->getSourceFile()); $classXml->appendChild($doc->createTextNode($class->getName())); if ($class->isAbstract()) { $this->abstractClasses->appendChild($classXml); } else { $this->concreteClasses->appendChild($classXml); } }
/** * testMarkClassInstanceAsAbstract * * @return void */ public function testMarkClassInstanceAsAbstract() { $class = new PHP_Depend_Code_Class(__CLASS__); $class->setModifiers(PHP_Depend_ConstantsI::IS_EXPLICIT_ABSTRACT); self::assertTrue($class->isAbstract()); }
/** * Tests that the default {@link PHP_Depend_Code_Class::isAbstract()} * value is <b>false</b> but could be changed. * * @return void * @covers PHP_Depend_Code_AbstractClassOrInterface * @covers PHP_Depend_Code_Class * @group pdepend * @group pdepend::code * @group unittest */ public function testMarkClassInstanceAsAbstract() { $class = new PHP_Depend_Code_Class('clazz', 0); $this->assertFalse($class->isAbstract()); $class->setModifiers(PHP_Depend_ConstantsI::IS_EXPLICIT_ABSTRACT); $this->assertTrue($class->isAbstract()); }