Esempio n. 1
0
 /**
  * Returns an iterator with all method/function parameters.
  *
  * <b>NOTE:</b> All node iterators return an alphabetic ordered list of
  * nodes. Use the {@link PHP_Depend_Code_Parameter::getPosition()} for the
  * correct parameter position.
  *
  * @return PHP_Depend_Code_NodeIterator
  */
 public function getParameters()
 {
     if ($this->_parameters === null) {
         $this->_initParameters();
     }
     $this->_parameters->rewind();
     return $this->_parameters;
 }
Esempio n. 2
0
 /**
  * Tests that the iterator returns the node name as key.
  *
  * @return void
  */
 public function testNodeIteratorLoopWithKey()
 {
     $names = array('clazz', 'func', 'method', 'pkg');
     $nodes = array(new PHP_Depend_Code_Class('clazz', 0, 'clazz.php'), new PHP_Depend_Code_Function('func', 0), new PHP_Depend_Code_Method('method', 0), new PHP_Depend_Code_Package('pkg'));
     $it = new PHP_Depend_Code_NodeIterator($nodes);
     for ($i = 0, $it->rewind(); $it->valid(); ++$i, $it->next()) {
         $this->assertSame($nodes[$i], $it->current());
         $this->assertEquals($names[$i], $it->key());
     }
 }