當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Node::getName方法代碼示例

本文整理匯總了PHP中Node::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Node::getName方法的具體用法?PHP Node::getName怎麽用?PHP Node::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Node的用法示例。


在下文中一共展示了Node::getName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteNode

 /**
  * @param Node $node
  */
 public function deleteNode(Node $node)
 {
     if (isset($this->nodes[$node->getName()])) {
         unset($this->nodes[$node->getName()]);
     } else {
         foreach ($this->nodes as $n) {
             $n->deleteNode($node);
         }
     }
 }
開發者ID:mrikirill,項目名稱:senior-task,代碼行數:13,代碼來源:TreeComposite.php

示例2: insertByPath

 /**
  * Recursively inserts a path of nodes
  * 
  * @param Node $curr_node
  * @param string $path a slash delimited path of node names
  * @param array $array optional data array added to last node in the path
  */
 public function insertByPath(&$curr_node, $path = '', $array = null)
 {
     if (is_string($path)) {
         $p = explode('/', $path);
         $n = array_shift($p);
         if ($curr_node instanceof Node) {
             $curr_name = $curr_node->getName();
         }
         if ($curr_name === $n) {
             if (isset($p[0])) {
                 $n = $p[0];
             }
             if ($next_node = $curr_node->getNode($n)) {
                 $next_node = $next_node;
             } else {
                 $next_node = $curr_node;
             }
         } else {
             $new_node = self::build($n);
             $new_node->setData($array);
             $curr_node->insert($new_node);
             $next_node = $new_node;
         }
         if ($n !== '') {
             $remaining_path = implode('/', $p);
             while (count($p) > 0) {
                 return $this->insertByPath($next_node, $remaining_path, $array);
             }
         }
     }
 }
開發者ID:mikecurtis1,項目名稱:Patterns-and-Data-Structures,代碼行數:38,代碼來源:nodepath.php

示例3: processNodeResult

 /**
  * Process the result of the given node. Returns false if no other nodes
  * should be run, or a string with the next node name.
  *
  * @param Node $node Node that was run
  *
  * @return string
  */
 protected function processNodeResult(Node $node)
 {
     $result = null;
     $name = $node->getName();
     if (isset($this->nodeResults[$name])) {
         foreach ($this->nodeResults[$name] as $resultInfo) {
             if ($resultInfo->appliesTo($node)) {
                 if ($resultInfo->isActionHangup()) {
                     // hanging up after $name
                     $this->client->hangup();
                 } elseif ($resultInfo->isActionJumpTo()) {
                     $data = $resultInfo->getActionData();
                     if (isset($data['nodeEval'])) {
                         $callback = $data['nodeEval'];
                         $nodeName = $callback($node);
                     } else {
                         $nodeName = $data['nodeName'];
                     }
                     // jumping from $name to $nodeName
                     $result = $nodeName;
                 } elseif ($resultInfo->isActionExecute()) {
                     // executing callback after $name
                     $data = $resultInfo->getActionData();
                     $callback = $data['callback'];
                     $callback($node);
                 }
             }
         }
     }
     return $result;
 }
開發者ID:excelwebzone,項目名稱:pastum,代碼行數:39,代碼來源:NodeController.php

示例4: __construct

 public function __construct(Node $node, User $user, $action)
 {
     $this->user = $user;
     $this->node = $node;
     $this->name = $node->getName();
     $this->description = $node->getDescription();
     $this->descr = $node->getDescr();
     $this->action = $action;
     $this->action_time = new \DateTime();
 }
開發者ID:samuvack,項目名稱:admin,代碼行數:10,代碼來源:NodeLog.php

示例5: buildXML

 private function buildXML(Node $node, $xml)
 {
     $xml .= '<node name="' . htmlentities($node->getName(), ENT_QUOTES, 'UTF-8') . '">';
     if ($node->hasProperties()) {
         $xml = $this->buildXMLProperties($node, $xml);
     }
     if ($node->hasNodes()) {
         $ni = $node->getNodes();
         while ($ni->hasNext()) {
             $temporaryNode = $ni->nextNode();
             if ($temporaryNode->hasNodes()) {
                 $xml = $this->buildXML($temporaryNode, $xml);
             } else {
                 $xml .= '<node name="' . htmlentities($temporaryNode->getName(), ENT_QUOTES, 'UTF-8') . '">';
                 if ($temporaryNode->hasProperties()) {
                     $xml = $this->buildXMLProperties($temporaryNode, $xml);
                 }
                 $xml .= '</node>';
             }
         }
     }
     return $xml .= '</node>';
 }
開發者ID:samueljwilliams,項目名稱:pcr,代碼行數:23,代碼來源:Session.php

示例6: _updateGraphPool

 /**
  * Updates the node pool of Graph
  * 
  * @param  Node   $node Node to be added to the pool
  * @return void
  * @access protected
  */
 public function _updateGraphPool(Node &$node)
 {
     $key = $this->_getKey($node->getName());
     $this->_pool[$key] = $node;
 }
開發者ID:ankitpokhrel,項目名稱:g-raph,代碼行數:12,代碼來源:Graph.php

示例7: nameAccessors

 public function nameAccessors()
 {
     $n = new Node('node');
     $n->setName('name');
     $this->assertEquals('name', $n->getName());
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:6,代碼來源:NodeTest.class.php

示例8: hasNode

 /**
  * Return TRUE if the given node is registered for this application
  *
  * @param Node $node
  * @return boolean
  */
 public function hasNode(Node $node)
 {
     return isset($this->nodes[$node->getName()]);
 }
開發者ID:hlubek,項目名稱:Deploy-Package,代碼行數:10,代碼來源:Application.php

示例9: writeTag

 /**
  * Write the given tag to the stream.
  *
  * @param resource $fPtr Stream pointer
  * @param Node     $node Tag to write
  *
  * @return bool
  */
 private function writeTag($fPtr, Node $node)
 {
     return $this->dataHandler->putTAGByte($fPtr, $node->getType()) && $this->dataHandler->putTAGString($fPtr, $node->getName()) && $this->writeType($fPtr, $node->getType(), $node);
 }
開發者ID:rickselby,項目名稱:nbt,代碼行數:12,代碼來源:Service.php

示例10: _unmarshall

 /**
  * Recursively deserialize data for the given node.
  *
  * @param   xml.Node node
  * @return  var
  * @throws  lang.IllegalArgumentException if the data cannot be deserialized
  * @throws  lang.ClassNotFoundException in case a XP object's class could not be loaded
  * @throws  xml.XMLFormatException
  */
 protected function _unmarshall(Node $node)
 {
     // value without type is supposed to be string (XML-RPC specs)
     if ('value' == $node->getName() && !isset($node->children[0])) {
         return (string) $node->getContent();
     }
     if (!isset($node->children[0])) {
         throw new XMLFormatException('Tried to access nonexistant node.');
     }
     // Simple form: If no subnode indicating the type exists, the type
     // is string, e.g. <value>Test</value>
     if (!$node->hasChildren()) {
         return (string) $node->getContent();
     }
     // Long form - with subnode, the type is derived from the node's name,
     // e.g. <value><string>Test</string></value>.
     $c = $node->nodeAt(0);
     switch ($c->getName()) {
         case 'struct':
             $ret = array();
             foreach ($c->getChildren() as $child) {
                 $data = array();
                 $data[$child->nodeAt(0)->getName()] = $child->nodeAt(0);
                 $data[$child->nodeAt(1)->getName()] = $child->nodeAt(1);
                 $ret[$data['name']->getContent()] = $this->_unmarshall($data['value']);
                 unset($data);
             }
             if (!isset($ret['__xp_class'])) {
                 return $ret;
             }
             // Check whether this is a XP object. If so, load the class and
             // create an instance without invoking the constructor.
             $fields = XPClass::forName($ret['__xp_class'])->getFields();
             $cname = array_search($ret['__xp_class'], xp::$cn, TRUE);
             $s = '';
             $n = 0;
             foreach ($fields as $field) {
                 if (!isset($ret[$field->getName()])) {
                     continue;
                 }
                 $m = $field->getModifiers();
                 if ($m & MODIFIER_STATIC) {
                     continue;
                 } else {
                     if ($m & MODIFIER_PUBLIC) {
                         $name = $field->getName();
                     } else {
                         if ($m & MODIFIER_PROTECTED) {
                             $name = "*" . $field->getName();
                         } else {
                             if ($m & MODIFIER_PRIVATE) {
                                 $name = "" . array_search($field->getDeclaringClass()->getName(), xp::$cn, TRUE) . "" . $field->getName();
                             }
                         }
                     }
                 }
                 $s .= 's:' . strlen($name) . ':"' . $name . '";' . serialize($ret[$field->getName()]);
                 $n++;
             }
             return unserialize('O:' . strlen($cname) . ':"' . $cname . '":' . $n . ':{' . $s . '}');
         case 'array':
             $ret = array();
             foreach ($c->nodeAt(0)->getChildren() as $child) {
                 $ret[] = $this->_unmarshall($child);
             }
             return $ret;
         case 'int':
         case 'i4':
             return (int) $c->getContent();
         case 'double':
             return (double) $c->getContent();
         case 'boolean':
             return (bool) $c->getContent();
         case 'string':
             return (string) $c->getContent();
         case 'dateTime.iso8601':
             return Date::fromString($c->getContent());
         case 'nil':
             return NULL;
         case 'base64':
             return new Bytes(base64_decode($c->getContent()));
         default:
             throw new IllegalArgumentException('Could not decode node as its type is not supported: ' . $c->getName());
     }
 }
開發者ID:Gamepay,項目名稱:xp-framework,代碼行數:94,代碼來源:XmlRpcDecoder.class.php

示例11: setNode

 /**
  * Sets a node in the $nodes array; uses the name of the node as index.
  *
  * Nodes can be retrieved by retrieving the property with the same name.
  * Thus 'node1' can be retrieved by invoking: $graph->node1
  *
  * @param \phpDocumentor\GraphViz\Node $node The node to set onto this Graph.
  *
  * @see \phpDocumentor\GraphViz\Node::create()
  *
  * @return \phpDocumentor\GraphViz\Graph
  */
 public function setNode(Node $node)
 {
     $this->nodes[$node->getName()] = $node;
     return $this;
 }
開發者ID:CobaltBlueDW,項目名稱:oddsandends,代碼行數:17,代碼來源:Graph.php

示例12: addNode

 /**
  * @param Node $node
  */
 public function addNode(Node $node)
 {
     $this->nodes[$node->getName()] = $node;
 }
開發者ID:siparker,項目名稱:pagerank,代碼行數:7,代碼來源:Graph.php

示例13: testSetNameMethod

 public function testSetNameMethod()
 {
     $this->object->setName('foo');
     $this->assertEquals('foo', $this->object->getName());
 }
開發者ID:CarsonF,項目名稱:WhatsApi,代碼行數:5,代碼來源:NodeTest.php

示例14: inArray

 /**
  * @param Node $needle
  * @param Node[] $haystack
  * @return bool True if $needle is in $haystack
  */
 private function inArray($needle, array $haystack)
 {
     foreach ($haystack as $straw) {
         if ($straw->getName() === $needle->getName()) {
             return true;
         }
     }
     return false;
 }
開發者ID:re222dv,項目名稱:1DV408-Project,代碼行數:14,代碼來源:Node.php

示例15: 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::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。