Skip to content

Commit

Permalink
Merge pull request #63 from programmatordev/SPA-71-add-new-hastimer-a…
Browse files Browse the repository at this point in the history
…ttribute-to-period-entity

Add new hasTimer property to Period entity
  • Loading branch information
andrepimpao authored Nov 28, 2023
2 parents ec98af1 + ca6b4c4 commit ac119fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/05-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@
- `getPeriodLength()`: `?int`
- `getMinutes()`: `?int`
- `getSeconds()`: `?int`
- `hasTimer()`: `bool`
- `getFixture()`: [`?Fixture`](#fixture) (`fixture` include is required)
- `getType()`: [`?Type`](#type) (`type` include is required)
- `getEvents()`: [`?Event[]`](#event) (`events` include is required)
Expand Down
8 changes: 8 additions & 0 deletions src/Entity/Period.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class Period

private ?int $seconds;

private bool $hasTimer;

private ?Fixture $fixture;

private ?Type $type;
Expand All @@ -52,6 +54,7 @@ public function __construct(array $data, string $timezone)
$this->id = $data['id'];
$this->fixtureId = $data['fixture_id'];
$this->typeId = $data['type_id'];
$this->hasTimer = $data['has_timer'];

// select
$this->startedAt = isset($data['started']) ? \DateTimeImmutable::createFromFormat('U', $data['started']) : null;
Expand Down Expand Up @@ -138,6 +141,11 @@ public function getSeconds(): ?int
return $this->seconds;
}

public function hasTimer(): bool
{
return $this->hasTimer;
}

public function getFixture(): ?Fixture
{
return $this->fixture;
Expand Down

0 comments on commit ac119fe

Please sign in to comment.