protected function getKsUniqueString() { if ($this->ks) { return $this->ks->getUniqueString(); } else { return substr(md5(rand(10000, 99999) . microtime(true)), 1, 7); //throw new Exception ( "Cannot find unique string" ); } }