PDepend\Report\Jdepend\Xml::setArtifacts PHP Method

setArtifacts() public method

Sets the context code nodes.
public setArtifacts ( PDepend\Source\AST\ASTArtifactList $artifacts ) : void
$artifacts PDepend\Source\AST\ASTArtifactList
return void
    public function setArtifacts(ASTArtifactList $artifacts)
    {
        $this->code = $artifacts;
    }

Usage Example

 /**
  * Tests that {@link \PDepend\Report\Jdepend\Xml::write()} generates the
  * expected document structure for the source, but without any applied
  * metrics.
  *
  * @return void
  */
 public function testXmlLogWithoutMetrics()
 {
     $this->packages = self::parseCodeResourceForTest();
     $this->analyzer = new DependencyAnalyzer();
     $this->analyzer->analyze($this->packages);
     $log = new Xml();
     $log->setLogFile($this->resultFile);
     $log->setArtifacts($this->packages);
     $log->log($this->analyzer);
     $log->close();
     $fileName = 'pdepend-log' . CORE_PACKAGE . '.xml';
     $this->assertXmlStringEqualsXmlString($this->getNormalizedPathXml(dirname(__FILE__) . "/_expected/{$fileName}"), file_get_contents($this->resultFile));
 }