/**
  * Deletes the uniqueness with given id.
  *
  * @param mixed $id
  *
  * @throws NonExistentIdSharedException
  */
 public function delete($id)
 {
     $result = $this->connectToStorageInternalWorker->connect()->remove(['id' => $id]);
     if (0 == $result['n']) {
         throw new NonExistentIdSharedException();
     }
 }
 /**
  * Picks the uniqueness with given id.
  *
  * @param string $id
  *
  * @return array An array with the following keys:
  *               id
  *
  * @throws NonExistentIdSharedException
  */
 public function pick($id)
 {
     $uniqueness = $this->connectToStorageInternalWorker->connect()->findOne(array('id' => $id));
     if (!$uniqueness) {
         throw new NonExistentIdSharedException($id);
     }
     return $uniqueness;
 }
 /**
  * Creates a uniqueness.
  *
  * @return string The already created id
  */
 public function create()
 {
     $id = uniqid();
     $this->connectToStorageInternalWorker->connect()->insert(['id' => $id]);
     return $id;
 }
 /**
  * Computes uniquenesses.
  *
  * @return int
  */
 public function compute()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->count();
 }
 /**
  * Purges uniquenesses.
  */
 public function purge()
 {
     $this->connectToStorageInternalWorker->connect()->drop();
 }
 /**
  * Creates a uniqueness.
  *
  * @param string $id
  */
 public function create($id)
 {
     $this->connectToStorageInternalWorker->connect()->insert(['id' => $id]);
 }
 /**
  * Collects uniquenesses.
  *
  * @return \Iterator An array with the following keys:
  *                   id
  */
 public function collect()
 {
     return $this->connectToStorageInternalWorker->connect()->find()->fields(['_id' => 0]);
 }
 /**
  * @return boolean
  */
 public function check()
 {
     return $this->connectToUniquenessStorageInternalWorker->connect()->find() ? true : false;
 }