Ejemplo n.º 1
0
 private function attachRandomTags(Item $item)
 {
     $tags_copy = $this->tags;
     $tags_to_attach = rand(0, sizeof($this->tags));
     for ($i = 0; $i < $tags_to_attach; $i++) {
         $index = rand(0, sizeof($tags_copy) - 1);
         $item->addTag($tags_copy[$index]);
         array_splice($tags_copy, $index, 1);
     }
 }