Conditions | 3 |
Paths | 2 |
Total Lines | 6 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
52 | public function initializeQuestionsIfEmpty(JobPoster $jobPoster) |
||
53 | { |
||
54 | if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count() === 0) { |
||
55 | $questions = $this->createDefaultQuestions($jobPoster->isInStrategicResponseDepartment()); |
||
56 | $jobPoster->job_poster_questions()->saveMany($questions); |
||
57 | $jobPoster->refresh(); |
||
58 | } |
||
61 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: