welcome back to dyb-tech

This commit is contained in:
Daniel Guzman
2024-05-18 02:28:01 +02:00
parent 9513cdba09
commit 9f30bc98c7
6149 changed files with 668407 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace DMD\LaLigaApi\Service\League;
use DMD\LaLigaApi\Dto\LeagueDto;
use DMD\LaLigaApi\Entity\League;
class LeagueFactory
{
public static function create(LeagueDto $leagueDto): League
{
$leagueEntity = new League();
if (!empty($leagueDto->name))
{
$leagueEntity->setName($leagueDto->name);
}
if (!empty($leagueDto->logo))
{
$leagueEntity->setLogo($leagueDto->logo);
}
if (!empty($leagueDto->description))
{
$leagueEntity->setDescription($leagueDto->description);
}
if (isset($leagueDto->pointsPerWin))
{
$leagueEntity->setPointsPerWin($leagueDto->pointsPerWin);
}
if (!empty($leagueDto->pointsPerDraw))
{
$leagueEntity->setPointsPerDraw($leagueDto->pointsPerDraw);
}
if (!empty($leagueDto->pointsPerLoss))
{
$leagueEntity->setPointsPerLoss($leagueDto->pointsPerLoss);
}
if (!empty($leagueDto->matchesBetweenTeams))
{
$leagueEntity->setMatchesBetweenTeams($leagueDto->matchesBetweenTeams);
}
if (!empty($leagueDto->blockedMatchDates))
{
$leagueEntity->setBlockedMatchDates($leagueDto->blockedMatchDates);
}
if (!empty($leagueDto->city))
{
$leagueEntity->setCity($leagueDto->city);
}
$leagueEntity->setActive(true);
return $leagueEntity;
}
}