key() public method

{@inheritDoc}
public key ( )
 public function key()
 {
     if (null === $this->entries) {
         $this->__load___();
     }
     return $this->entries->key();
 }
 /**
  * Tests IdentityWrapper->key()
  */
 public function testKey()
 {
     $this->assertSame(key($this->entries), $this->identityWrapper->key());
     $this->identityWrapper->clear();
     $this->assertNull($this->identityWrapper->key());
     $this->assertNull($this->wrappedCollection->key());
 }
Example #3
0
 /**
  * @dataProvider provideDifferentElements
  */
 public function testNext($elements)
 {
     $collection = new ArrayCollection($elements);
     while (true) {
         $collectionNext = $collection->next();
         $arrayNext = next($elements);
         if (!$collectionNext || !$arrayNext) {
             break;
         }
         $this->assertSame($arrayNext, $collectionNext, "Returned value of ArrayCollection::next() and next() not match");
         $this->assertSame(key($elements), $collection->key(), "Keys not match");
         $this->assertSame(current($elements), $collection->current(), "Current values not match");
     }
 }
 /** {@inheritDoc} */
 public function key()
 {
     $this->initialize();
     return $this->collection->key();
 }
Example #5
0
 /**
  * Gets the key/index of the element at the current iterator position.
  *
  * @return int|string
  */
 public function key()
 {
     return $this->collection->key();
 }
 function key()
 {
     return $this->fields->key();
 }