Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 18 |
CRAP | |
0.00% |
0 / 1 |
| StravaLink | |
0.00% |
0 / 19 |
|
0.00% |
0 / 18 |
380 | |
0.00% |
0 / 1 |
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAccessToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAccessToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getExpiresAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setExpiresAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getRefreshToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setRefreshToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStravaUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setStravaUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLinkedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setLinkedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| testOnlyGetField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Entity; |
| 4 | |
| 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | use Olz\Entity\Common\TestableInterface; |
| 7 | use Olz\Entity\Users\User; |
| 8 | use Olz\Repository\StravaLinkRepository; |
| 9 | |
| 10 | #[ORM\Table(name: 'strava_links')] |
| 11 | #[ORM\Index(name: 'user_id_index', columns: ['user_id'])] |
| 12 | #[ORM\Entity(repositoryClass: StravaLinkRepository::class)] |
| 13 | class StravaLink implements TestableInterface { |
| 14 | #[ORM\Column(type: 'text', nullable: false)] |
| 15 | private string $access_token; |
| 16 | |
| 17 | #[ORM\Column(type: 'datetime', nullable: false)] |
| 18 | private \DateTime $expires_at; |
| 19 | |
| 20 | #[ORM\Column(type: 'text', nullable: false)] |
| 21 | private string $refresh_token; |
| 22 | |
| 23 | #[ORM\ManyToOne(targetEntity: User::class)] |
| 24 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)] |
| 25 | private User $user; |
| 26 | |
| 27 | #[ORM\Column(type: 'text', nullable: false)] |
| 28 | private string $strava_user; |
| 29 | |
| 30 | #[ORM\Column(type: 'datetime', nullable: false, options: ['default' => 'CURRENT_TIMESTAMP'])] |
| 31 | private \DateTime $created_at; |
| 32 | |
| 33 | #[ORM\Column(type: 'datetime', nullable: true)] |
| 34 | private ?\DateTime $linked_at; |
| 35 | |
| 36 | #[ORM\Id] |
| 37 | #[ORM\Column(type: 'bigint', nullable: false)] |
| 38 | #[ORM\GeneratedValue] |
| 39 | private int|string $id; |
| 40 | |
| 41 | public function getId(): ?int { |
| 42 | return isset($this->id) ? intval($this->id) : null; |
| 43 | } |
| 44 | |
| 45 | public function setId(int $new_id): void { |
| 46 | $this->id = $new_id; |
| 47 | } |
| 48 | |
| 49 | public function getAccessToken(): string { |
| 50 | return $this->access_token; |
| 51 | } |
| 52 | |
| 53 | public function setAccessToken(string $new_access_token): void { |
| 54 | $this->access_token = $new_access_token; |
| 55 | } |
| 56 | |
| 57 | public function getExpiresAt(): \DateTime { |
| 58 | return $this->expires_at; |
| 59 | } |
| 60 | |
| 61 | public function setExpiresAt(\DateTime $new_expires_at): void { |
| 62 | $this->expires_at = $new_expires_at; |
| 63 | } |
| 64 | |
| 65 | public function getRefreshToken(): string { |
| 66 | return $this->refresh_token; |
| 67 | } |
| 68 | |
| 69 | public function setRefreshToken(string $new_refresh_token): void { |
| 70 | $this->refresh_token = $new_refresh_token; |
| 71 | } |
| 72 | |
| 73 | public function getUser(): User { |
| 74 | return $this->user; |
| 75 | } |
| 76 | |
| 77 | public function setUser(User $new_user): void { |
| 78 | $this->user = $new_user; |
| 79 | } |
| 80 | |
| 81 | public function getStravaUser(): string { |
| 82 | return $this->strava_user; |
| 83 | } |
| 84 | |
| 85 | public function setStravaUser(string $new_strava_user): void { |
| 86 | $this->strava_user = $new_strava_user; |
| 87 | } |
| 88 | |
| 89 | public function getCreatedAt(): \DateTime { |
| 90 | return $this->created_at; |
| 91 | } |
| 92 | |
| 93 | public function setCreatedAt(\DateTime $new_value): void { |
| 94 | $this->created_at = $new_value; |
| 95 | } |
| 96 | |
| 97 | public function getLinkedAt(): ?\DateTime { |
| 98 | return $this->linked_at; |
| 99 | } |
| 100 | |
| 101 | public function setLinkedAt(?\DateTime $new_value): void { |
| 102 | $this->linked_at = $new_value; |
| 103 | } |
| 104 | |
| 105 | // --- |
| 106 | |
| 107 | public function __toString(): string { |
| 108 | $id = $this->getId(); |
| 109 | return "StravaLink (ID: {$id})"; |
| 110 | } |
| 111 | |
| 112 | public function testOnlyGetField(string $field_name): mixed { |
| 113 | return $this->{$field_name}; |
| 114 | } |
| 115 | } |