for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Stu\Module\Colony\Lib\Gui\Component;
use Stu\Component\Crew\CrewCountRetrieverInterface;
use Stu\Component\Player\CrewLimitCalculatorInterface;
use Stu\Lib\Colony\PlanetFieldHostInterface;
use Stu\Module\Control\GameControllerInterface;
final class SocialProvider implements GuiComponentProviderInterface
{
private CrewCountRetrieverInterface $crewCountRetriever;
private CrewLimitCalculatorInterface $crewLimitCalculator;
public function __construct(
CrewLimitCalculatorInterface $crewLimitCalculator,
CrewCountRetrieverInterface $crewCountRetriever
) {
$this->crewCountRetriever = $crewCountRetriever;
$this->crewLimitCalculator = $crewLimitCalculator;
}
public function setTemplateVariables(
PlanetFieldHostInterface $host,
GameControllerInterface $game
): void {
$user = $game->getUser();
$game->setTemplateVar(
'CREW_COUNT_DEBRIS_AND_TRADE_POSTS',
$this->crewCountRetriever->getDebrisAndTradePostsCount($user)
);
'CREW_COUNT_SHIPS',
$this->crewCountRetriever->getAssignedToShipsCount($user)
'CREW_COUNT_TRAINING',
$this->crewCountRetriever->getInTrainingCount($user)
'CREW_COUNT_REMAINING',
$this->crewCountRetriever->getRemainingCount($user)
'GLOBAL_CREW_LIMIT',
$this->crewLimitCalculator->getGlobalCrewLimit($user)