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


PHP Node::getAttributes方法代码示例

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


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

示例1: getAttributes

 /**
  * Returns node attributes including (lazily) calculated ones.
  *
  * @return  array
  * @see     Node::getAttributes()
  */
 public function getAttributes()
 {
     $attributes = parent::getAttributes();
     $errors = count($this->errors);
     $failures = count($this->failures);
     if (0 < $errors) {
         $attributes['errors'] = $errors;
     }
     if (0 < $failures) {
         $attributes['failures'] = $failures;
     }
     return $attributes;
 }
开发者ID:mneudert,项目名称:junit-scribe,代码行数:19,代码来源:CaseNode.php

示例2: testConstruct

 /**
  * @dataProvider provideNodes
  */
 public function testConstruct(array $attributes, Node $node)
 {
     $this->assertSame('Dummy', $node->getType());
     $this->assertSame(array('subNode1', 'subNode2'), $node->getSubNodeNames());
     $this->assertSame(10, $node->getLine());
     $this->assertSame('/** doc comment */', $node->getDocComment()->getText());
     $this->assertSame('value1', $node->subNode1);
     $this->assertSame('value2', $node->subNode2);
     $this->assertTrue(isset($node->subNode1));
     $this->assertTrue(isset($node->subNode2));
     $this->assertFalse(isset($node->subNode3));
     $this->assertSame($attributes, $node->getAttributes());
     return $node;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:17,代码来源:NodeAbstractTest.php

示例3: applyArgs

 protected function applyArgs(Node $node)
 {
     if ($node instanceof TextNode) {
         $node->setContent($this->interpolate($node->getContent()));
     } else {
         if ($node instanceof Element) {
             foreach ($node->getAttributes() as $attr => $value) {
                 $node->setAttribute($attr, $this->interpolate($value));
             }
         }
     }
     foreach ($node->getChildren() as $child) {
         $this->applyArgs($child);
     }
 }
开发者ID:torbenkoehn,项目名称:php-xtpl,代码行数:15,代码来源:IncludeElement.php

示例4: getAttributes

 /**
  * Returns node attributes including (lazily) calculated ones.
  *
  * @return  array
  * @see     Node::getAttributes()
  */
 public function getAttributes()
 {
     $attributes = parent::getAttributes();
     $tests = count($this->cases);
     $errors = 0;
     $failures = 0;
     $time = 0;
     if (count($this->cases)) {
         foreach ($this->cases as $case) {
             $errors += $case->getAttribute('errors');
             $failures += $case->getAttribute('failures');
             $time += (double) $case->getAttribute('time');
         }
     }
     if (count($this->suites)) {
         foreach ($this->suites as $suite) {
             $errors += $suite->getAttribute('errors');
             $failures += $suite->getAttribute('failures');
             $tests += $suite->getAttribute('tests');
             $time += $suite->getAttribute('time');
         }
     }
     if (0 < $errors) {
         $attributes['errors'] = $errors;
     }
     if (0 < $failures) {
         $attributes['failures'] = $failures;
     }
     if (0 < $tests) {
         $attributes['tests'] = $tests;
     }
     if (0 < $time) {
         $attributes['time'] = $time;
     }
     return $attributes;
 }
开发者ID:mneudert,项目名称:junit-scribe,代码行数:42,代码来源:SuiteNode.php

示例5: toArray

 /**
  * Returns an array representation of the given Node structure.
  *
  * @param Node $node
  *
  * @return array
  */
 public function toArray(Node $node)
 {
     return array('name' => $node->getName(), 'value' => $node->getValue(), 'attributes' => $node->getAttributes(), 'children' => array_map(function (Node $child) {
         return $this->toArray($child);
     }, $node->getChildren()));
 }
开发者ID:dborsatto,项目名称:object-xml,代码行数:13,代码来源:Manager.php


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