Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 13 |
CRAP | |
0.00% |
0 / 1 |
StravaLink | |
0.00% |
0 / 13 |
|
0.00% |
0 / 13 |
210 | |
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 | |||
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\Id] |
31 | #[ORM\Column(type: 'bigint', nullable: false)] |
32 | #[ORM\GeneratedValue] |
33 | private int|string $id; |
34 | |
35 | public function getId(): ?int { |
36 | return isset($this->id) ? intval($this->id) : null; |
37 | } |
38 | |
39 | public function setId(int $new_id): void { |
40 | $this->id = $new_id; |
41 | } |
42 | |
43 | public function getAccessToken(): string { |
44 | return $this->access_token; |
45 | } |
46 | |
47 | public function setAccessToken(string $new_access_token): void { |
48 | $this->access_token = $new_access_token; |
49 | } |
50 | |
51 | public function getExpiresAt(): \DateTime { |
52 | return $this->expires_at; |
53 | } |
54 | |
55 | public function setExpiresAt(\DateTime $new_expires_at): void { |
56 | $this->expires_at = $new_expires_at; |
57 | } |
58 | |
59 | public function getRefreshToken(): string { |
60 | return $this->refresh_token; |
61 | } |
62 | |
63 | public function setRefreshToken(string $new_refresh_token): void { |
64 | $this->refresh_token = $new_refresh_token; |
65 | } |
66 | |
67 | public function getUser(): User { |
68 | return $this->user; |
69 | } |
70 | |
71 | public function setUser(User $new_user): void { |
72 | $this->user = $new_user; |
73 | } |
74 | |
75 | public function getStravaUser(): string { |
76 | return $this->strava_user; |
77 | } |
78 | |
79 | public function setStravaUser(string $new_strava_user): void { |
80 | $this->strava_user = $new_strava_user; |
81 | } |
82 | |
83 | // --- |
84 | |
85 | public function testOnlyGetField(string $field_name): mixed { |
86 | return $this->{$field_name}; |
87 | } |
88 | } |