Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 13 |
CRAP | |
0.00% |
0 / 1 |
| AccessToken | |
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 | |||
| getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPurpose | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setPurpose | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setToken | |
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 | |||
| getExpiresAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setExpiresAt | |
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\AccessTokenRepository; |
| 9 | |
| 10 | #[ORM\Table(name: 'access_tokens')] |
| 11 | #[ORM\Index(name: 'token_index', columns: ['token'])] |
| 12 | #[ORM\Index(name: 'user_id_index', columns: ['user_id'])] |
| 13 | #[ORM\Entity(repositoryClass: AccessTokenRepository::class)] |
| 14 | class AccessToken implements TestableInterface { |
| 15 | #[ORM\ManyToOne(targetEntity: User::class)] |
| 16 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)] |
| 17 | private ?User $user; |
| 18 | |
| 19 | #[ORM\Column(type: 'string', nullable: false)] |
| 20 | private string $purpose; |
| 21 | |
| 22 | #[ORM\Column(type: 'string', nullable: false)] |
| 23 | private string $token; |
| 24 | |
| 25 | #[ORM\Column(type: 'datetime', nullable: false)] |
| 26 | private \DateTime $created_at; |
| 27 | |
| 28 | #[ORM\Column(type: 'datetime', nullable: true)] |
| 29 | private ?\DateTime $expires_at; |
| 30 | |
| 31 | #[ORM\Id] |
| 32 | #[ORM\Column(type: 'bigint', nullable: false)] |
| 33 | #[ORM\GeneratedValue] |
| 34 | private int|string $id; |
| 35 | |
| 36 | public function getId(): ?int { |
| 37 | return isset($this->id) ? intval($this->id) : null; |
| 38 | } |
| 39 | |
| 40 | public function setId(int $new_id): void { |
| 41 | $this->id = $new_id; |
| 42 | } |
| 43 | |
| 44 | public function getUser(): ?User { |
| 45 | return $this->user; |
| 46 | } |
| 47 | |
| 48 | public function setUser(?User $new_user): void { |
| 49 | $this->user = $new_user; |
| 50 | } |
| 51 | |
| 52 | public function getPurpose(): string { |
| 53 | return $this->purpose; |
| 54 | } |
| 55 | |
| 56 | public function setPurpose(string $new_purpose): void { |
| 57 | $this->purpose = $new_purpose; |
| 58 | } |
| 59 | |
| 60 | public function getToken(): string { |
| 61 | return $this->token; |
| 62 | } |
| 63 | |
| 64 | public function setToken(string $new_token): void { |
| 65 | $this->token = $new_token; |
| 66 | } |
| 67 | |
| 68 | public function getCreatedAt(): \DateTime { |
| 69 | return $this->created_at; |
| 70 | } |
| 71 | |
| 72 | public function setCreatedAt(\DateTime $new_created_at): void { |
| 73 | $this->created_at = $new_created_at; |
| 74 | } |
| 75 | |
| 76 | public function getExpiresAt(): ?\DateTime { |
| 77 | return $this->expires_at; |
| 78 | } |
| 79 | |
| 80 | public function setExpiresAt(?\DateTime $new_expires_at): void { |
| 81 | $this->expires_at = $new_expires_at; |
| 82 | } |
| 83 | |
| 84 | // --- |
| 85 | |
| 86 | public function testOnlyGetField(string $field_name): mixed { |
| 87 | return $this->{$field_name}; |
| 88 | } |
| 89 | } |