当前位置: 首页>>代码示例>>PHP>>正文


PHP fDOMDocument::appendChild方法代码示例

本文整理汇总了PHP中TheSeer\fDOM\fDOMDocument::appendChild方法的典型用法代码示例。如果您正苦于以下问题:PHP fDOMDocument::appendChild方法的具体用法?PHP fDOMDocument::appendChild怎么用?PHP fDOMDocument::appendChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TheSeer\fDOM\fDOMDocument的用法示例。


在下文中一共展示了fDOMDocument::appendChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 public function generate()
 {
     $document = new fDOMDocument();
     // summary
     $root = $document->createElement('phpact');
     $root->setAttribute('project', $this->summary->getProjectName());
     $root->setAttribute('base', $this->summary->getBaseVersion());
     $root->setAttribute('challenger', $this->summary->getChallengerVersion());
     $root->setAttribute('date', date('c', $this->summary->getTime()));
     $root->setAttribute('signature', strip_tags($this->summary->getSignature()));
     // difference list
     $grouped = $this->groupDifferences($this->differences, Difference::UNIT_NAME);
     foreach ($grouped as $unitName => $differences) {
         /* @var $differences \RenanBr\PhpAct\Difference\DifferenceCollection */
         $family = $differences->current()->getTag(Difference::UNIT_FAMILY);
         $unitElement = $root->createElement($family);
         $unitElement->setAttribute('name', $unitName);
         $this->append($unitElement, 'constant', $differences, Difference::CONSTANT_NAME);
         $this->append($unitElement, 'member', $differences, Difference::MEMBER_NAME);
         $this->append($unitElement, 'method', $differences, Difference::METHOD_NAME);
         $root->appendChild($unitElement);
     }
     $document->appendChild($root);
     $document->preserveWhiteSpace = false;
     $document->formatOutput = true;
     return $document->saveXML();
 }
开发者ID:renanbr,项目名称:phpact,代码行数:27,代码来源:XmlReport.php

示例2: __construct

 /**
  * @param string       $name
  * @param \SplFileInfo $file
  */
 public function __construct($name = NULL, \SplFileInfo $file = NULL) {
     if ($this->rootName === NULL) {
         throw new UnitObjectException('No or invalid rootname set', UnitObjectException::InvalidRootname);
     }
     $this->dom = new fDOMDocument('1.0', 'UTF-8');
     $this->dom->registerNamespace('phpdox', self::XMLNS);
     $this->rootNode = $this->dom->createElementNS(self::XMLNS, $this->rootName);
     $this->dom->appendChild($this->rootNode);
     if ($name !== NULL) {
         $this->setName($name, $this->rootNode);
     }
     if ($file !== NULL) {
         $this->setFileHeader($file);
     }
     $this->setAbstract(FALSE);
     $this->setFinal(FALSE);
 }
开发者ID:rxz135cc,项目名称:yii2webApp,代码行数:21,代码来源:AbstractUnitObject.php

示例3: testParse

 /**
  * @ covers TheSeer\phpDox\DocBlock\Parser::__construct
  * @ covers TheSeer\phpDox\DocBlock\Parser::parse
  *
  * @dataProvider docblockSources
  */
 public function testParse($src)
 {
     $expected = new fDOMDocument();
     $dir = __DIR__ . '/../../data/docbock/';
     $block = file_get_contents($dir . $src);
     $expected->load($dir . $src . '.xml');
     $factory = new Factory();
     $parser = new Parser($factory);
     $result = $parser->parse($block, array());
     $this->assertInstanceOf('TheSeer\\phpDox\\DocBlock\\DocBlock', $result);
     $dom = new fDOMDocument();
     $dom->appendChild($result->asDom($dom));
     $this->assertEquals($expected->documentElement, $dom->documentElement);
 }
开发者ID:gandazgul,项目名称:phpdox,代码行数:20,代码来源:parserTest.php

示例4: mergeFiles

 /**
  * Merge all files.
  *
  * @param string $directory
  * @param Finder $finder
  *
  * @return fDOMDocument
  */
 private function mergeFiles($directory, Finder $finder)
 {
     $outXml = new fDOMDocument();
     $outXml->formatOutput = true;
     $outTestSuites = $outXml->createElement('testsuites');
     $outXml->appendChild($outTestSuites);
     $outTestSuite = $outXml->createElement('testsuite');
     $outTestSuites->appendChild($outTestSuite);
     $tests = 0;
     $assertions = 0;
     $failures = 0;
     $errors = 0;
     $time = 0;
     /** @var SplFileInfo $file */
     foreach ($finder as $file) {
         if ($this->isFileEmpty($file)) {
             continue;
         }
         $inXml = $this->loadFile($file->getRealpath());
         foreach ($inXml->query('//testsuites/testsuite') as $inElement) {
             $inName = $inElement->getAttribute('name');
             $outName = $inName;
             $suffix = 2;
             while ($outTestSuite->query('//testsuite[@name="' . $outName . '"]')->length !== 0) {
                 $outName = $inName . '_' . $suffix;
                 $suffix++;
             }
             $outElement = $outXml->importNode($inElement, true);
             $outElement->setAttribute('name', $outName);
             $outTestSuite->appendChild($outElement);
             $tests += $inElement->getAttribute('tests');
             $assertions += $inElement->getAttribute('assertions');
             $failures += $inElement->getAttribute('failures');
             $errors += $inElement->getAttribute('errors');
             $time += $inElement->getAttribute('time');
         }
     }
     $outTestSuite->setAttribute('name', $directory);
     $outTestSuite->setAttribute('tests', $tests);
     $outTestSuite->setAttribute('assertions', $assertions);
     $outTestSuite->setAttribute('failures', $failures);
     $outTestSuite->setAttribute('errors', $errors);
     $outTestSuite->setAttribute('time', $time);
     return $outXml;
 }
开发者ID:andreas-weber,项目名称:php-junit-merge,代码行数:53,代码来源:Command.php


注:本文中的TheSeer\fDOM\fDOMDocument::appendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。