Skip to content

Commit

Permalink
feat: added team squad resource
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepimpao committed May 22, 2024
1 parent 61432ff commit 12fbf2e
Show file tree
Hide file tree
Showing 26 changed files with 246 additions and 267 deletions.
21 changes: 4 additions & 17 deletions docs/03-supported-endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,6 @@ $response = $api->teams()->getAllBySearchQuery('sporting');
### Team Squads

- [Official documentation](https://docs.sportmonks.com/football/endpoints-and-entities/endpoints/team-squads)
- Cache default max age: `1 day`

#### `getAllByTeamId`

Expand All @@ -1100,26 +1099,18 @@ getAllByTeamId(int $teamId): TeamSquadCollection
Get complete team squad by team id:

```php
$squad = $sportMonksFootball->teamSquads()->getAllByTeamId(1);

foreach ($squad->getData() as $player) {
echo $player->getPlayerId();
}
$response = $api->teamSquads()->getAllByTeamId(1);
```
#### `getAllExtendedByTeamId`

```php
getAllExtendedByTeamId(int $teamId): PlayerCollection
```

Get complete team squad entried based on the current season by team id:
Get complete team squad entries based on the current season by team id:

```php
$squad = $sportMonksFootball->teamSquads()->getAllExtendedByTeamId(1);

foreach ($squad->getData() as $player) {
echo $player->getName();
}
$response = $api->teamSquads()->getAllExtendedByTeamId(1);
```

#### `getAllBySeasonIdAndTeamId`
Expand All @@ -1131,11 +1122,7 @@ getAllBySeasonIdAndTeamId(int $seasonId, int $teamId): TeamSquadCollection
Get complete team squad of one team by season id and team id:

```php
$squad = $sportMonksFootball->teamSquads()->getAllBySeasonIdAndTeamId(1, 1);

foreach ($squad->getData() as $player) {
echo $player->getPlayerId();
}
$response = $api->teamSquads()->getAllBySeasonIdAndTeamId(1, 1);
```

### Topscorers
Expand Down
34 changes: 17 additions & 17 deletions docs/05-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
- `getStateId()`: `int`
- `getVenueId()`: `?int`
- `getName()`: `?string`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getResultInfo()`: `?string`
- `getLeg()`: `?string`
- `getDetails()`: `?string`
Expand Down Expand Up @@ -330,8 +330,8 @@
- `getSeasonId()`: `int`
- `getStageId()`: `int`
- `getName()`: `?string`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `hasGamesInCurrentWeek()`: `?bool`
- `isCurrent()`: `?bool`
- `hasFinished()`: `?bool`
Expand Down Expand Up @@ -419,8 +419,8 @@
- `getId()`: `int`
- `getFixtureId()`: `int`
- `getTypeId()`: `int`
- `getStartedAt()`: `?\DateTimeImmutable`
- `getEndedAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `getCountsFrom()`: `?int`
- `isTicking()`: `?bool`
- `getSortOrder()`: `?int`
Expand Down Expand Up @@ -553,8 +553,8 @@
- `getName()`: `?string`
- `hasFinished()`: `?bool`
- `isCurrent()`: `?bool`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `hasGamesInCurrentWeek()`: `?bool`
- `getSport()`: [`?Sport`](#sport) (`sport` include is required)
- `getLeague()`: [`?League`](#league) (`league` include is required)
Expand Down Expand Up @@ -586,8 +586,8 @@
- `hasFinished()`: `?bool`
- `isPending()`: `?bool`
- `isCurrent()`: `?bool`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `getStandingsRecalculatedAt()`: `?\DateTimeImmutable`
- `hasGamesInCurrentWeek()`: `?bool`
- `getSport()`: [`?Sport`](#sport) (`sport` include is required)
Expand All @@ -608,8 +608,8 @@
- `getTeamId()`: `int`
- `getSeasonId()`: `?int`
- `getCategory()`: `?string`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `getGamesMissed()`: `?int`
- `isCompleted()`: `?bool`
- `getTeam()`: [`?Team`](#team) (`team` include is required)
Expand Down Expand Up @@ -643,8 +643,8 @@
- `getSortOrder()`: `?int`
- `hasFinished()`: `?bool`
- `isCurrent()`: `?bool`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `hasGamesInCurrentWeek()`: `?bool`
- `getTieBreakerRuleId()`: `?bool`
- `getLeague()`: [`?League`](#league) (`league` include is required)
Expand Down Expand Up @@ -786,8 +786,8 @@
- `getCoachId()`: `int`
- `getPositionId()`: `int`
- `isActive()`: `?bool`
- `getStartedAt()`: `?\DateTimeImmutable`
- `getEndedAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `isTemporary()`: `?bool`
- `getTeam()`: [`?Team`](#team) (`team` include is required)
- `getCoach()`: [`?Coach`](#coach) (`coach` include is required)
Expand Down Expand Up @@ -825,8 +825,8 @@
- `getTeamId()`: `int`
- `getPosition()`: `int`
- `getDetailedPositionId()`: `?int`
- `getStartingAt()`: `?\DateTimeImmutable`
- `getEndingAt()`: `?\DateTimeImmutable`
- `getStartAt()`: `?\DateTimeImmutable`
- `getEndAt()`: `?\DateTimeImmutable`
- `isCaptain()`: `?bool`
- `getJerseyNumber()`: `?int`
- `getTeam()`: [`?Team`](#team) (`team` include is required)
Expand Down
71 changes: 0 additions & 71 deletions src/Endpoint/TeamSquadEndpoint.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/Entity/Fixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Fixture

private ?string $name;

private ?\DateTimeImmutable $startingAt;
private ?\DateTimeImmutable $startAt;

private ?string $resultInfo;

Expand Down Expand Up @@ -123,7 +123,7 @@ public function __construct(array $data, string $timezone)

// select
$this->name = $data['name'] ?? null;
$this->startingAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at'], new \DateTimeZone($timezone)) : null;
$this->startAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at'], new \DateTimeZone($timezone)) : null;
$this->resultInfo = $data['result_info'] ?? null;
$this->leg = $data['leg'] ?? null;
$this->details = $data['details'] ?? null;
Expand Down Expand Up @@ -216,9 +216,9 @@ public function getName(): ?string
return $this->name;
}

public function getStartingAt(): ?\DateTimeImmutable
public function getStartAt(): ?\DateTimeImmutable
{
return $this->startingAt;
return $this->startAt;
}

public function getResultInfo(): ?string
Expand Down
16 changes: 8 additions & 8 deletions src/Entity/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class Group

private ?string $name;

private ?\DateTimeImmutable $startingAt;
private ?\DateTimeImmutable $startAt;

private ?\DateTimeImmutable $endingAt;
private ?\DateTimeImmutable $endAt;

private ?bool $hasGamesInCurrentWeek;

Expand All @@ -37,8 +37,8 @@ public function __construct(array $data)
$this->stageId = $data['stage_id'];

$this->name = $data['name'] ?? null;
$this->startingAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at']) : null;
$this->endingAt = isset($data['ending_at']) ? new \DateTimeImmutable($data['ending_at']) : null;
$this->startAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at']) : null;
$this->endAt = isset($data['ending_at']) ? new \DateTimeImmutable($data['ending_at']) : null;
$this->hasGamesInCurrentWeek = $data['games_in_current_week'] ?? null;
$this->isCurrent = $data['is_current'] ?? null;
$this->hasFinished = $data['finished'] ?? null;
Expand Down Expand Up @@ -75,14 +75,14 @@ public function getName(): ?string
return $this->name;
}

public function getStartingAt(): ?\DateTimeImmutable
public function getStartAt(): ?\DateTimeImmutable
{
return $this->startingAt;
return $this->startAt;
}

public function getEndingAt(): ?\DateTimeImmutable
public function getEndAt(): ?\DateTimeImmutable
{
return $this->endingAt;
return $this->endAt;
}

public function hasGamesInCurrentWeek(): ?bool
Expand Down
16 changes: 8 additions & 8 deletions src/Entity/Period.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class Period

private int $typeId;

private ?\DateTimeImmutable $startedAt;
private ?\DateTimeImmutable $startAt;

private ?\DateTimeImmutable $endedAt;
private ?\DateTimeImmutable $endAt;

private ?int $countsFrom;

Expand Down Expand Up @@ -57,8 +57,8 @@ public function __construct(array $data, string $timezone)
$this->hasTimer = $data['has_timer'];

// select
$this->startedAt = isset($data['started']) ? \DateTimeImmutable::createFromFormat('U', $data['started']) : null;
$this->endedAt = isset($data['ended']) ? \DateTimeImmutable::createFromFormat('U', $data['ended']) : null;
$this->startAt = isset($data['started']) ? \DateTimeImmutable::createFromFormat('U', $data['started']) : null;
$this->endAt = isset($data['ended']) ? \DateTimeImmutable::createFromFormat('U', $data['ended']) : null;
$this->countsFrom = $data['counts_from'] ?? null;
$this->isTicking = $data['ticking'] ?? null;
$this->sortOrder = $data['sort_order'] ?? null;
Expand Down Expand Up @@ -91,14 +91,14 @@ public function getTypeId(): int
return $this->typeId;
}

public function getStartedAt(): ?\DateTimeImmutable
public function getStartAt(): ?\DateTimeImmutable
{
return $this->startedAt;
return $this->startAt;
}

public function getEndedAt(): ?\DateTimeImmutable
public function getEndAt(): ?\DateTimeImmutable
{
return $this->endedAt;
return $this->endAt;
}

public function getCountsFrom(): ?int
Expand Down
16 changes: 8 additions & 8 deletions src/Entity/Round.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Round

private ?bool $isCurrent;

private ?\DateTimeImmutable $startingAt;
private ?\DateTimeImmutable $startAt;

private ?\DateTimeImmutable $endingAt;
private ?\DateTimeImmutable $endAt;

private ?bool $hasGamesInCurrentWeek;

Expand Down Expand Up @@ -56,8 +56,8 @@ public function __construct(array $data, string $timezone)
$this->name = $data['name'] ?? null;
$this->hasFinished = $data['finished'] ?? null;
$this->isCurrent = $data['is_current'] ?? null;
$this->startingAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at']) : null;
$this->endingAt = isset($data['ending_at']) ? new \DateTimeImmutable($data['ending_at']) : null;
$this->startAt = isset($data['starting_at']) ? new \DateTimeImmutable($data['starting_at']) : null;
$this->endAt = isset($data['ending_at']) ? new \DateTimeImmutable($data['ending_at']) : null;
$this->hasGamesInCurrentWeek = $data['games_in_current_week'] ?? null;

// include
Expand Down Expand Up @@ -109,14 +109,14 @@ public function isCurrent(): ?bool
return $this->isCurrent;
}

public function getStartingAt(): ?\DateTimeImmutable
public function getStartAt(): ?\DateTimeImmutable
{
return $this->startingAt;
return $this->startAt;
}

public function getEndingAt(): ?\DateTimeImmutable
public function getEndAt(): ?\DateTimeImmutable
{
return $this->endingAt;
return $this->endAt;
}

public function hasGamesInCurrentWeek(): ?bool
Expand Down
Loading

0 comments on commit 12fbf2e

Please sign in to comment.