parameterBag = $parameterBag; } public function isComplete(WorkshopInterface $workshop): bool { $gauge = $this->parameterBag->get('app.workshop.gauge'); $countEntriesRegistered = $this->countEntriesRegistered($workshop); return $countEntriesRegistered >= $gauge; } public function getRemainingPlaces(WorkshopInterface $workshop) { $gauge = $this->parameterBag->get('app.workshop.gauge'); $countEntriesRegistered = $this->countEntriesRegistered($workshop); return $gauge - $countEntriesRegistered; } public function countEntriesAnimators(WorkshopInterface $workshop): int { return count($this->getEntriesByIsAnimator($workshop, true)); } public function countEntriesRegistered(WorkshopInterface $workshop): int { return count($this->getEntriesByIsAnimator($workshop, false)); } public function getEntriesRegistered(WorkshopInterface $workshop) { return $this->getEntriesByIsAnimator($workshop, false); } public function hasEntryAnimator(WorkshopInterface $workshop): bool { return $this->countEntriesAnimators($workshop) > 0; } public function getEntriesAnimators(WorkshopInterface $workshop) { return $this->getEntriesByIsAnimator($workshop, true); } public function getOneEntryAnimator(WorkshopInterface $workshop) { $entriesAnimatorArray = $this->getEntriesByIsAnimator($workshop, true); if($entriesAnimatorArray && count($entriesAnimatorArray) > 0) { return $entriesAnimatorArray[0]; } return false; } public function getEntriesByIsAnimator(WorkshopInterface $workshop, bool $isAnimator): array { $entryArray = []; foreach($workshop->getEntries() as $entry) { if($entry->isAnimator() == $isAnimator) { $entryArray[] = $entry; } } return $entryArray; } }