/** * @param Entity $projectile */ public function setProjectile(Entity $projectile) { if ($projectile !== $this->projectile) { if (count($this->projectile->getViewers()) === 0) { $this->projectile->kill(); $this->projectile->close(); } $this->projectile = $projectile; } }