public function getRandomQuestionCollection($requiredAmount) { $randomKeys = $this->getRandomArrayKeys($this->questions, $requiredAmount); $randomQuestionCollection = new self(); foreach ($randomKeys as $randomKey) { $randomQuestionCollection->addQuestion($this->questions[$randomKey]); } return $randomQuestionCollection; }