/** * Returns the unique key of the current leaf. * * @return null|int|string Returns the unique key of the current leaf on * success, null otherwise */ public function key() { if (is_null($this->current)) { $this->current = current($this->branch); } if ($this->current instanceof RecursiveLeafInterface) { return $this->current->key(); } }