/**
  * Creates and get a new DOM unique ID
  *
  * @param   string      $id         A string that will be used to construct the ID
  * @param   string      $reference  A reference used to store the ID (and retrieve it - by default `$id`)
  *
  * @return  string      The unique ID created
  */
 public function set($id, &$reference = null)
 {
     $new_id = $id;
     $counter = 0;
     while ($this->exists($new_id)) {
         $counter++;
         $new_id = $id . '-' . $counter;
     }
     $_reference = $reference;
     if (empty($_reference)) {
         $_reference = $id;
     }
     if ($this->has($_reference)) {
         $counter = 0;
         while ($this->has($_reference)) {
             $counter++;
             $_reference = $reference . '-' . $counter;
         }
     }
     $reference = $_reference;
     $this->dom_ids->set($reference, $new_id);
     return $new_id;
 }
 /**
  * Sets a cached content for an index
  *
  * @param string $index
  * @param mixed $object
  *
  * @return $this
  */
 public function setCache($index, $object)
 {
     $this->_cache->set($index, $object);
     return $this;
 }