Exemplo n.º 1
0
 public static function getAvailableKey()
 {
     while (true) {
         $length = rand(4, 6);
         $key = MyStringGenerator::createRandomString($length);
         $img = self::getImageByKey($key);
         if ($img == null) {
             return $key;
         }
     }
 }
Exemplo n.º 2
0
 private function getAvailableKey()
 {
     while (true) {
         $length = rand(4, 6);
         $key = MyStringGenerator::createRandomString($length);
         $img = $this->findOneBy(array('key' => $key));
         if ($img == null) {
             return $key;
         }
     }
 }