當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。