Lines
100.00%
2 / 2
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| getUrl | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getPictureUrl | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | ||
| 48 | class DoneBanner | |
| 49 | { | |
| 50 | public const string READ = 'done_banner:read'; | |
| 51 | ||
| 52 | public const string WRITE = 'done_banner:write'; | |
| 53 | ||
| 54 | #[Column, Id, GeneratedValue] | |
| 55 | #[Groups([self::READ])] | |
| 56 | public ?int $id = null; | |
| 57 | ||
| 58 | #[ManyToOne, JoinColumn(nullable: false, onDelete: 'CASCADE'), Ignore] | |
| 59 | public ?User $owner = null; | |
| 60 | ||
| 61 | /** The Bannergress id, e.g. cologne-cathedral-57d4. */ | |
| 62 | #[Column(length: 200)] | |
| 63 | #[Groups([self::READ])] | |
| 64 | public string $bannerId = ''; | |
| 65 | ||
| 66 | #[Column(length: 200)] | |
| 67 | #[Groups([self::READ])] | |
| 68 | public string $title = ''; | |
| 69 | ||
| 70 | #[Column] | |
| 71 | #[Groups([self::READ])] | |
| 72 | public int $missions = 0; | |
| 73 | ||
| 74 | /** Relative to Bannergress::PICTURE_BASE. */ | |
| 75 | #[Column(length: 150, nullable: true)] | |
| 76 | #[Groups([self::READ])] | |
| 77 | public ?string $picture = null; | |
| 78 | ||
| 79 | /** Where the banner starts. */ | |
| 80 | #[Column(nullable: true)] | |
| 81 | #[Groups([self::READ])] | |
| 82 | public ?float $startLatitude = null; | |
| 83 | ||
| 84 | #[Column(nullable: true)] | |
| 85 | #[Groups([self::READ])] | |
| 86 | public ?float $startLongitude = null; | |
| 87 | ||
| 88 | /** On the done list: 0 is the newest. */ | |
| 89 | #[Column] | |
| 90 | #[Ignore] | |
| 91 | public int $position = 0; | |
| 92 | ||
| 93 | /** The day the user did it; null until set. */ | |
| 94 | #[Column(type: Types::DATE_IMMUTABLE, nullable: true)] | |
| 95 | #[Context([DateTimeNormalizer::FORMAT_KEY => TimelineEvent::DATE_FORMAT])] | |
| 96 | #[Groups([self::READ, self::WRITE])] | |
| 97 | public ?\DateTimeImmutable $doneAt = null; | |
| 98 | ||
| 99 | #[Ignore] | |
| 100 | public function getUrl(): string | |
| 101 | { | |
| 102 | return Bannergress::BANNER_BASE.\rawurlencode($this->bannerId); | |
| 103 | } | |
| 104 | ||
| 105 | #[Ignore] | |
| 106 | public function getPictureUrl(): ?string | |
| 107 | { | |
| 108 | return null === $this->picture ? null : Bannergress::PICTURE_BASE.$this->picture; | |
| 109 | } | |
| 110 | } |