[limb-svn] r6567 - in 3.x/trunk/limb/macro: src/compiler src/tags/core src/tags/pager tests/cases/compiler

svn at limb-project.com svn at limb-project.com
Mon Dec 3 16:48:07 MSK 2007


Author: serega
Date: 2007-12-03 16:48:07 +0300 (Mon, 03 Dec 2007)
New Revision: 6567
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6567

Modified:
   3.x/trunk/limb/macro/src/compiler/lmbMacroNode.class.php
   3.x/trunk/limb/macro/src/compiler/lmbMacroTag.class.php
   3.x/trunk/limb/macro/src/tags/core/slot.tag.php
   3.x/trunk/limb/macro/src/tags/pager/pager.tag.php
   3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroNodeTest.class.php
   3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagTest.class.php
Log:
-- lmbMacroNode :: $id property renamed to $node_id. lmbMacroNode :: getId() -> getNodeId(), setId() -> setNodeId().

Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroNode.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroNode.class.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroNode.class.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -15,7 +15,7 @@
  */
 class lmbMacroNode
 {
-  protected $id;
+  protected $node_id;
   protected $children = array();
   protected $parent;
   /**
@@ -56,18 +56,18 @@
     return $this->location->getLine();
   }
 
-  function getId()
+  function getNodeId()
   {
-    if($this->id)
-      return $this->id;
+    if($this->node_id)
+      return $this->node_id;
 
-    $this->id = self :: generateNewId();
-    return $this->id;
+    $this->node_id = self :: generateNewId();
+    return $this->node_id;
   }
 
-  function setId($id)
+  function setNodeId($node_id)
   {
-    $this->id = $id;
+    $this->node_id = $node_id;
   }
 
   static function generateNewId()
@@ -93,7 +93,7 @@
   {
     foreach($this->children as $key => $child)
     {
-      if($child->getId() == $id)
+      if($child->getNodeId() == $id)
       {
         unset($this->children[$key]);
         return $child;
@@ -127,7 +127,7 @@
   {
     foreach($this->children as $child)
     {
-      if($child->getId() == $id)
+      if($child->getNodeId() == $id)
         return $child;
       else
       {
@@ -234,7 +234,7 @@
     $checked_children = array();
     foreach($this->getChildren() as $key => $child)
     {
-      $id = $child->getId();
+      $id = $child->getNodeId();
       if(in_array($id, $child_ids))
       {
         $duplicate_child = $checked_children[$id];

Modified: 3.x/trunk/limb/macro/src/compiler/lmbMacroTag.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/compiler/lmbMacroTag.class.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/src/compiler/lmbMacroTag.class.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -43,22 +43,22 @@
     return $this->has_closing_tag = $flag;
   }
 
-  function getId()
+  function getNodeId()
   {
-    if($this->id)
-      return $this->id;
+    if($this->node_id)
+      return $this->node_id;
 
     if($id = $this->get('id'))
-      $this->id = $id;
+      $this->node_id = $id;
     else
-      $this->id = self :: generateNewId();
+      $this->node_id = self :: generateNewId();
 
-    return $this->id;
+    return $this->node_id;
   }
   
-  function getEscapedId()
+  function getEscapedNodeId()
   {
-    $id = $this->getId();
+    $id = $this->getNodeId();
     return "'" .  $id . "'";
   }
 

Modified: 3.x/trunk/limb/macro/src/tags/core/slot.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/slot.tag.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/src/tags/core/slot.tag.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -18,7 +18,7 @@
 {
   function generate($code)
   {
-    $slot = $this->getId();
+    $slot = $this->getNodeId();
     //calling slot handler in case of dynamic wrapping
     $code->writePHP('if(isset($this->__slot_handler_' . $slot . ')) {');
     $code->writePHP('call_user_func_array($this->__slot_handler_' . $slot . ', array());');

Modified: 3.x/trunk/limb/macro/src/tags/pager/pager.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/pager/pager.tag.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/src/tags/pager/pager.tag.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -33,7 +33,7 @@
   
   protected function _generatePagerHelperWithInitialParams($code, $pager)
   {
-    $id = $this->getEscapedId();
+    $id = $this->getEscapedNodeId();
     $code->writeToInit("{$pager} = new lmbMacroPagerHelper({$id});\n");
 
     if ($total_items = $this->getEscaped('total_items'))
@@ -78,7 +78,7 @@
 
   function getPagerVar()
   {
-    return '$this->pager_' . $this->getId(); 
+    return '$this->pager_' . $this->getNodeId(); 
   }
 }
 

Modified: 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroNodeTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroNodeTest.class.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroNodeTest.class.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -26,7 +26,7 @@
   protected function _createNode($id = 'node', $parent = null)
   {
     $node = new lmbMacroNode($this->source_location);
-    $node->setId($id);
+    $node->setNodeId($id);
     
     if($parent)
       $parent->addChild($node);
@@ -34,21 +34,21 @@
     return $node;
   }
 
-  function testGetId()
+  function testGetNodeId()
   {
-    $this->node->setId('Test');
-    $this->assertEqual($this->node->getId(), 'Test');
+    $this->node->setNodeId('Test');
+    $this->assertEqual($this->node->getNodeId(), 'Test');
   }
 
-  function testGetIdGenerated()
+  function testGetNodeIdGenerated()
   {
-    $id = $this->node->getId();
-    $this->assertEqual($this->node->getId(), $id);
+    $id = $this->node->getNodeId();
+    $this->assertEqual($this->node->getNodeId(), $id);
   }
   
-  function testGetIdByDefault()
+  function testGetNodeIdByDefault()
   {
-    $this->assertNotNull($this->node->getId());
+    $this->assertNotNull($this->node->getNodeId());
   }
   
   function testGetChildren()
@@ -61,7 +61,7 @@
   function testFindChild()
   {
     $child = $this->_createNode();
-    $child->setId('Test');
+    $child->setNodeId('Test');
     $this->node->addChild($child);
     $this->assertEqual($this->node->findChild('Test'), $child);
   }
@@ -107,9 +107,9 @@
     $node1 = $this->_createNode('foo', $parent1);
     $node2 = $this->_createNode('bar', $parent2);
     
-    $this->assertEqual($node2->findUpChild('foo')->getId(), $node1->getId());
-    $this->assertEqual($parent1->findUpChild('parent2')->getId(), $parent2->getId());
-    $this->assertEqual($parent1->findUpChild('foo')->getId(), $node1->getId());
+    $this->assertEqual($node2->findUpChild('foo')->getNodeId(), $node1->getNodeId());
+    $this->assertEqual($parent1->findUpChild('parent2')->getNodeId(), $parent2->getNodeId());
+    $this->assertEqual($parent1->findUpChild('foo')->getNodeId(), $node1->getNodeId());
   }
 
   function testFindChildByClassAmongImmediateChildren()
@@ -216,11 +216,11 @@
   {
     $root = new lmbMacroNode();
     $child1 = new lmbMacroNode(new lmbMacroSourceLocation('my_file', 10));
-    $child1->setId('my_tag');
+    $child1->setNodeId('my_tag');
     $root->addChild($child1);
 
     $child2 = new lmbMacroNode(new lmbMacroSourceLocation('my_file2', 15));
-    $child2->setId('my_tag');
+    $child2->setNodeId('my_tag');
     $root->addChild($child2);
 
     try

Modified: 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagTest.class.php	2007-12-03 13:42:37 UTC (rev 6566)
+++ 3.x/trunk/limb/macro/tests/cases/compiler/lmbMacroTagTest.class.php	2007-12-03 13:48:07 UTC (rev 6567)
@@ -109,27 +109,27 @@
     $this->assertFalse($this->node->getBool('I'));
   }
   
-  function testGetId()
+  function testGetNodeId()
   {
-    $this->node->setId('Test');
-    $this->assertEqual($this->node->getId(), 'Test');
+    $this->node->setNodeId('Test');
+    $this->assertEqual($this->node->getNodeId(), 'Test');
   }
 
-  function testGetIdGenerated()
+  function testGetNodeIdGenerated()
   {
-    $id = $this->node->getId();
-    $this->assertEqual($this->node->getId(), $id);
+    $id = $this->node->getNodeId();
+    $this->assertEqual($this->node->getNodeId(), $id);
   }
   
-  function testGetIdByDefault()
+  function testGetNodeIdByDefault()
   {
-    $this->assertNotNull($this->node->getId());
+    $this->assertNotNull($this->node->getNodeId());
   }
      
-  function testGetId_ByIdAttribute()
+  function testGetNodeId_ByIdAttribute()
   {
     $this->node->set('id', 'my_tag');
-    $this->assertEqual($this->node->getId(), 'my_tag');
+    $this->assertEqual($this->node->getNodeId(), 'my_tag');
   }
 
   function testGenerate()



More information about the limb-svn mailing list