Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 1 |
| Counter | |
0.00% |
0 / 12 |
|
0.00% |
0 / 12 |
182 | |
0.00% |
0 / 1 |
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setPage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDateRange | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setDateRange | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getArgs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setArgs | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getCounter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setCounter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| incrementCounter | |
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\Repository\CounterRepository; |
| 8 | |
| 9 | #[ORM\Table(name: 'counter')] |
| 10 | #[ORM\Index(name: 'date_range_page_index', columns: ['date_range', 'page'])] |
| 11 | #[ORM\Entity(repositoryClass: CounterRepository::class)] |
| 12 | class Counter implements TestableInterface { |
| 13 | #[ORM\Id] |
| 14 | #[ORM\Column(type: 'bigint', nullable: false)] |
| 15 | #[ORM\GeneratedValue] |
| 16 | private int|string $id; |
| 17 | |
| 18 | #[ORM\Column(type: 'string', nullable: true)] |
| 19 | private ?string $page; |
| 20 | |
| 21 | #[ORM\Column(type: 'string', nullable: true)] |
| 22 | private ?string $date_range; |
| 23 | |
| 24 | #[ORM\Column(type: 'text', nullable: true)] |
| 25 | private ?string $args; |
| 26 | |
| 27 | #[ORM\Column(type: 'integer', nullable: true)] |
| 28 | private ?int $counter; |
| 29 | // PRIMARY KEY (`id`) |
| 30 | |
| 31 | public function getId(): ?int { |
| 32 | return isset($this->id) ? intval($this->id) : null; |
| 33 | } |
| 34 | |
| 35 | public function setId(int $new_id): void { |
| 36 | $this->id = $new_id; |
| 37 | } |
| 38 | |
| 39 | public function getPage(): ?string { |
| 40 | return $this->page; |
| 41 | } |
| 42 | |
| 43 | public function setPage(?string $new_page): void { |
| 44 | $this->page = $new_page; |
| 45 | } |
| 46 | |
| 47 | public function getDateRange(): ?string { |
| 48 | return $this->date_range; |
| 49 | } |
| 50 | |
| 51 | public function setDateRange(?string $new_date_range): void { |
| 52 | $this->date_range = $new_date_range; |
| 53 | } |
| 54 | |
| 55 | public function getArgs(): ?string { |
| 56 | return $this->args; |
| 57 | } |
| 58 | |
| 59 | public function setArgs(?string $new_args): void { |
| 60 | $this->args = $new_args; |
| 61 | } |
| 62 | |
| 63 | public function getCounter(): ?int { |
| 64 | return $this->counter; |
| 65 | } |
| 66 | |
| 67 | public function setCounter(?int $new_counter): void { |
| 68 | $this->counter = $new_counter; |
| 69 | } |
| 70 | |
| 71 | public function incrementCounter(): void { |
| 72 | $this->setCounter($this->getCounter() + 1); |
| 73 | } |
| 74 | |
| 75 | // --- |
| 76 | |
| 77 | public function testOnlyGetField(string $field_name): mixed { |
| 78 | return $this->{$field_name}; |
| 79 | } |
| 80 | } |