Skip to content

Commit

Permalink
Merge pull request #74 from programmatordev/2.x
Browse files Browse the repository at this point in the history
v2.3.0
  • Loading branch information
andrepimpao authored Jan 28, 2025
2 parents e614a57 + dea763c commit 3b1efd3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"programmatordev/yet-another-php-validator": "^1.3"
},
"require-dev": {
"monolog/monolog": "^3.7",
"monolog/monolog": "^3.8",
"nyholm/psr7": "^1.8",
"php-http/mock-client": "^1.6",
"phpunit/phpunit": "^10.5",
Expand Down
3 changes: 3 additions & 0 deletions docs/05-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
- `getPlayerId()`: `?int`
- `getRelatedPlayerId()`: `?int`
- `getPeriodId()`: `int`
- `getDetailedPeriodId()`: `?int`
- `getParticipantId()`: `int`
- `getSortOrder()`: `?int`
- `getCoachId()`: `?int`
Expand All @@ -222,6 +223,7 @@
- `getRelatedPlayer()`: [`?Player`](#player) (`relatedPlayer` include is required)
- `getParticipant()`: [`?Team`](#team) (`participant` include is required)
- `getPeriod()`: [`?Period`](#period) (`period` include is required)
- `getDetailedPeriod()`: [`?Period`](#period) (`detailedPeriod` include is required)

### Fixture

Expand Down Expand Up @@ -263,6 +265,7 @@
- `getTimeline()`: [`?Event[]`](#event) (`timeline` include is required)
- `getStatistics()`: [`?FixtureStatistic[]`](#fixturestatistic) (`statistics` include is required)
- `getPeriods()`: [`?Period[]`](#period) (`periods` include is required)
- `getDetailedPeriods`: [`?Period[]`](#period) (`detailedPeriods` include is required)
- `getFormations()`: [`?Formation[]`](#formation) (`formations` include is required)
- `getScores()`: [`?Score[]`](#score) (`scores` include is required)
- `getTvStations()`: [`?FixtureTvStation[]`](#fixturetvstation) (`tvStations` include is required)
Expand Down
16 changes: 16 additions & 0 deletions src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Event

private int $periodId;

private ?int $detailedPeriodId;

private int $participantId;

private ?int $sortOrder;
Expand Down Expand Up @@ -56,6 +58,8 @@ class Event

private ?Period $period;

private ?Period $detailedPeriod;

public function __construct(array $data, string $timezone)
{
$this->id = $data['id'];
Expand All @@ -64,6 +68,7 @@ public function __construct(array $data, string $timezone)
$this->playerId = $data['player_id'] ?? null;
$this->relatedPlayerId = $data['related_player_id'] ?? null;
$this->periodId = $data['period_id'];
$this->detailedPeriodId = $data['detailed_period_id'] ?? null;
$this->participantId = $data['participant_id'];
$this->sortOrder = $data['sort_order'] ?? null;

Expand All @@ -88,6 +93,7 @@ public function __construct(array $data, string $timezone)
$this->relatedPlayer = isset($data['relatedplayer']) ? new Player($data['relatedplayer'], $timezone) : null;
$this->participant = isset($data['participant']) ? new Team($data['participant'], $timezone) : null;
$this->period = isset($data['period']) ? new Period($data['period'], $timezone) : null;
$this->detailedPeriod = isset($data['detailedperiod']) ? new Period($data['detailedperiod'], $timezone) : null;
}

public function getId(): int
Expand Down Expand Up @@ -120,6 +126,11 @@ public function getPeriodId(): int
return $this->periodId;
}

public function getDetailedPeriodId(): ?int
{
return $this->detailedPeriodId;
}

public function getParticipantId(): int
{
return $this->participantId;
Expand Down Expand Up @@ -219,4 +230,9 @@ public function getPeriod(): ?Period
{
return $this->period;
}

public function getDetailedPeriod(): ?Period
{
return $this->detailedPeriod;
}
}
9 changes: 9 additions & 0 deletions src/Entity/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class Fixture
/** @var ?Period[] */
private ?array $periods;

/** @var ?Period[] */
private ?array $detailedPeriods;

/** @var ?Formation[] */
private ?array $formations;

Expand Down Expand Up @@ -152,6 +155,7 @@ public function __construct(array $data, string $timezone)
$this->timeline = isset($data['timeline']) ? $this->createEntityCollection(Event::class, $data['timeline'], $timezone) : null;
$this->statistics = isset($data['statistics']) ? $this->createEntityCollection(FixtureStatistic::class, $data['statistics'], $timezone) : null;
$this->periods = isset($data['periods']) ? $this->createEntityCollection(Period::class, $data['periods'], $timezone) : null;
$this->detailedPeriods = isset($data['detailedperiods']) ? $this->createEntityCollection(Period::class, $data['detailedperiods'], $timezone) : null;
$this->formations = isset($data['formations']) ? $this->createEntityCollection(Formation::class, $data['formations'], $timezone) : null;
$this->scores = isset($data['scores']) ? $this->createEntityCollection(Score::class, $data['scores'], $timezone) : null;
$this->tvStations = isset($data['tvstations']) ? $this->createEntityCollection(FixtureTvStation::class, $data['tvstations'], $timezone) : null;
Expand Down Expand Up @@ -351,6 +355,11 @@ public function getPeriods(): ?array
return $this->periods;
}

public function getDetailedPeriods(): ?array
{
return $this->detailedPeriods;
}

public function getFormations(): ?array
{
return $this->formations;
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function testMethods(): void
'player_id' => 1,
'related_player_id' => 1,
'period_id' => 1,
'detailed_period_id' => 1,
'participant_id' => 1,
'sort_order' => 1,
'section' => 'section',
Expand All @@ -37,6 +38,7 @@ public function testMethods(): void
$this->assertSame(1, $entity->getPlayerId());
$this->assertSame(1, $entity->getRelatedPlayerId());
$this->assertSame(1, $entity->getPeriodId());
$this->assertSame(1, $entity->getDetailedPeriodId());
$this->assertSame(1, $entity->getParticipantId());
$this->assertSame(1, $entity->getSortOrder());
$this->assertSame('section', $entity->getSection());
Expand Down

0 comments on commit 3b1efd3

Please # to comment.