-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor de la liste des antennes en DTOs
- Loading branch information
Showing
7 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Antenne | ||
{ | ||
public string $code; | ||
public string $label; | ||
public Position $position; | ||
public Meetup $meetup; | ||
public string $logoUrl; | ||
public Socials $socials; | ||
public Map $map; | ||
|
||
/** @var array<string> */ | ||
public array $departments; | ||
|
||
/** @var array<string>|null */ | ||
public ?array $pays; | ||
|
||
/** | ||
* @param string[] $departments | ||
* @param string[] $pays | ||
*/ | ||
public function __construct( | ||
string $code, | ||
string $label, | ||
Position $position, | ||
Meetup $meetup, | ||
string $logoUrl, | ||
Socials $socials, | ||
Map $map, | ||
array $departments, | ||
?array $pays | ||
) { | ||
$this->code = $code; | ||
$this->label = $label; | ||
$this->position = $position; | ||
$this->meetup = $meetup; | ||
$this->logoUrl = $logoUrl; | ||
$this->socials = $socials; | ||
$this->departments = $departments; | ||
$this->pays = $pays; | ||
$this->map = $map; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
final class AntennesCollection | ||
{ | ||
/** @var list<Antenne> */ | ||
private array $antennes; | ||
|
||
public function __construct() | ||
{ | ||
$this->antennes[] = new Antenne( | ||
'bordeaux', | ||
'Bordeaux', | ||
new Position('44.837912', '-0.579541'), | ||
new Meetup('bordeaux-php-meetup', '18197674'), | ||
'/images/offices/bordeaux.svg', | ||
new Socials( | ||
null, | ||
null, | ||
'AFUP_Bordeaux', | ||
'afup-bordeaux', | ||
'bordeaux.afup.org', | ||
), | ||
new Map( | ||
new Point('330', '440'), | ||
new Point('270', '500'), | ||
new Point('230', '500'), | ||
new Position('44.837912', '-0.579541'), | ||
false, | ||
'right', | ||
), | ||
['33'], | ||
null, | ||
); | ||
} | ||
|
||
/** | ||
* @return list<Antenne> | ||
*/ | ||
public function getAll(): array | ||
{ | ||
return $this->antennes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Map | ||
{ | ||
public Point $legendFirstPoint; | ||
public Point $legendSecondPoint; | ||
public Point $legendThirdPoint; | ||
public Position $point; | ||
|
||
public bool $useSecondColor; | ||
public string $legendAttachment; | ||
|
||
public ?Point $legendSecondCityFirstPoint; | ||
Check failure on line 20 in sources/AppBundle/Offices/Map.php
|
||
public ?Point $legendSecondCitySecondPoint; | ||
Check failure on line 21 in sources/AppBundle/Offices/Map.php
|
||
public ?Point $legendSecondCityThirdPoint; | ||
Check failure on line 22 in sources/AppBundle/Offices/Map.php
|
||
public ?Position $pointSecondCity; | ||
Check failure on line 23 in sources/AppBundle/Offices/Map.php
|
||
|
||
public function __construct( | ||
Point $legendFirstPoint, | ||
Point $legendSecondPoint, | ||
Point $legendThirdPoint, | ||
Position $point, | ||
bool $useSecondColor, | ||
string $legendAttachment | ||
) { | ||
$this->legendFirstPoint = $legendFirstPoint; | ||
$this->legendSecondPoint = $legendSecondPoint; | ||
$this->legendThirdPoint = $legendThirdPoint; | ||
$this->point = $point; | ||
$this->useSecondColor = $useSecondColor; | ||
$this->legendAttachment = $legendAttachment; | ||
} | ||
|
||
public function withSecondCity( | ||
?Point $legendSecondCityFirstPoint, | ||
?Point $legendSecondCitySecondPoint, | ||
?Point $legendSecondCityThirdPoint, | ||
?Position $pointSecondCity | ||
) { | ||
$this->legendSecondCityFirstPoint = $legendSecondCityFirstPoint; | ||
$this->legendSecondCitySecondPoint = $legendSecondCitySecondPoint; | ||
$this->legendSecondCityThirdPoint = $legendSecondCityThirdPoint; | ||
$this->pointSecondCity = $pointSecondCity; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Meetup | ||
{ | ||
public string $urlName; | ||
public string $id; | ||
|
||
public function __construct(string $urlName, string $id) | ||
{ | ||
$this->urlName = $urlName; | ||
$this->id = $id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Point | ||
{ | ||
public string $x; | ||
public string $y; | ||
|
||
public function __construct(string $x, string $y) | ||
{ | ||
$this->x = $x; | ||
$this->y = $y; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Position | ||
{ | ||
public string $latitude; | ||
public string $longitude; | ||
|
||
public function __construct(string $latitude, string $longitude) | ||
{ | ||
$this->latitude = $latitude; | ||
$this->longitude = $longitude; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Offices; | ||
|
||
/** | ||
* @readonly | ||
*/ | ||
final class Socials | ||
{ | ||
public ?string $youtube; | ||
public ?string $blog; | ||
public ?string $twitter; | ||
public ?string $linkedin; | ||
public ?string $bluesky; | ||
|
||
public function __construct( | ||
?string $youtube, | ||
?string $blog, | ||
?string $twitter, | ||
?string $linkedin, | ||
?string $bluesky | ||
) { | ||
$this->youtube = $youtube; | ||
$this->blog = $blog; | ||
$this->twitter = $twitter; | ||
$this->linkedin = $linkedin; | ||
$this->bluesky = $bluesky; | ||
} | ||
} |