-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from programmatordev/2.x
v2.2.0
- Loading branch information
Showing
4 changed files
with
107 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
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,59 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Entity; | ||
|
||
class Ranking | ||
{ | ||
private ?int $id; | ||
|
||
private ?int $participantId; | ||
|
||
private ?int $sportId; | ||
|
||
private ?int $position; | ||
|
||
private ?int $points; | ||
|
||
private ?string $type; | ||
|
||
public function __construct(array $data) | ||
{ | ||
// select | ||
$this->id = $data['id'] ?? null; | ||
$this->participantId = $data['participant_id'] ?? null; | ||
$this->sportId = $data['sport_id'] ?? null; | ||
$this->position = $data['position'] ?? null; | ||
$this->points = $data['points'] ?? null; | ||
$this->type = $data['type'] ?? null; | ||
} | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getParticipantId(): ?int | ||
{ | ||
return $this->participantId; | ||
} | ||
|
||
public function getSportId(): ?int | ||
{ | ||
return $this->sportId; | ||
} | ||
|
||
public function getPosition(): ?int | ||
{ | ||
return $this->position; | ||
} | ||
|
||
public function getPoints(): ?int | ||
{ | ||
return $this->points; | ||
} | ||
|
||
public function getType(): ?string | ||
{ | ||
return $this->type; | ||
} | ||
} |
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
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,28 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Test\Unit; | ||
|
||
use ProgrammatorDev\SportMonksFootball\Entity\Ranking; | ||
use ProgrammatorDev\SportMonksFootball\Test\AbstractTest; | ||
|
||
class RankingTest extends AbstractTest | ||
{ | ||
public function testMethods(): void | ||
{ | ||
$entity = new Ranking([ | ||
'id' => 1, | ||
'participant_id' => 1, | ||
'sport_id' => 1, | ||
'position' => 1, | ||
'points' => 1, | ||
'type' => 'type' | ||
]); | ||
|
||
$this->assertSame(1, $entity->getId()); | ||
$this->assertSame(1, $entity->getParticipantId()); | ||
$this->assertSame(1, $entity->getSportId()); | ||
$this->assertSame(1, $entity->getPosition()); | ||
$this->assertSame(1, $entity->getPoints()); | ||
$this->assertSame('type', $entity->getType()); | ||
} | ||
} |