|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace VideoGamesRecords\IgdbBundle\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
8
|
|
|
|
|
9
|
|
|
#[ORM\Entity] |
|
10
|
|
|
#[ORM\Table(name: 'igdb_platform_logo')] |
|
11
|
|
|
class PlatformLogo |
|
12
|
|
|
{ |
|
13
|
|
|
#[ORM\Id] |
|
14
|
|
|
#[ORM\Column(type: 'integer')] |
|
15
|
|
|
private int $id; |
|
16
|
|
|
|
|
17
|
|
|
#[ORM\Column(type: 'boolean')] |
|
18
|
|
|
private bool $alphaChannel; |
|
19
|
|
|
|
|
20
|
|
|
#[ORM\Column(type: 'boolean')] |
|
21
|
|
|
private bool $animated; |
|
22
|
|
|
|
|
23
|
|
|
#[ORM\Column(type: 'string', length: 255, nullable: true)] |
|
24
|
|
|
private ?string $checksum = null; |
|
25
|
|
|
|
|
26
|
|
|
#[ORM\Column(type: 'integer')] |
|
27
|
|
|
private int $height; |
|
28
|
|
|
|
|
29
|
|
|
#[ORM\Column(type: 'string', length: 255)] |
|
30
|
|
|
private string $imageId; |
|
31
|
|
|
|
|
32
|
|
|
#[ORM\Column(type: 'string', length: 500, nullable: true)] |
|
33
|
|
|
private ?string $url = null; |
|
34
|
|
|
|
|
35
|
|
|
#[ORM\Column(type: 'integer')] |
|
36
|
|
|
private int $width; |
|
37
|
|
|
|
|
38
|
|
|
#[ORM\Column(type: 'datetime_immutable')] |
|
39
|
|
|
private \DateTimeImmutable $createdAt; |
|
40
|
|
|
|
|
41
|
|
|
#[ORM\Column(type: 'datetime_immutable')] |
|
42
|
|
|
private \DateTimeImmutable $updatedAt; |
|
43
|
|
|
|
|
44
|
|
|
public function __construct() |
|
45
|
|
|
{ |
|
46
|
|
|
$this->createdAt = new \DateTimeImmutable(); |
|
47
|
|
|
$this->updatedAt = new \DateTimeImmutable(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getId(): int |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->id; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function setId(int $id): void |
|
56
|
|
|
{ |
|
57
|
|
|
$this->id = $id; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function isAlphaChannel(): bool |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->alphaChannel; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function setAlphaChannel(bool $alphaChannel): void |
|
66
|
|
|
{ |
|
67
|
|
|
$this->alphaChannel = $alphaChannel; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
public function isAnimated(): bool |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->animated; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function setAnimated(bool $animated): void |
|
76
|
|
|
{ |
|
77
|
|
|
$this->animated = $animated; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function getChecksum(): ?string |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->checksum; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function setChecksum(?string $checksum): void |
|
86
|
|
|
{ |
|
87
|
|
|
$this->checksum = $checksum; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getHeight(): int |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->height; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function setHeight(int $height): void |
|
96
|
|
|
{ |
|
97
|
|
|
$this->height = $height; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getImageId(): string |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->imageId; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function setImageId(string $imageId): void |
|
106
|
|
|
{ |
|
107
|
|
|
$this->imageId = $imageId; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
public function getUrl(): ?string |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->url; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
public function setUrl(?string $url): void |
|
116
|
|
|
{ |
|
117
|
|
|
$this->url = $url; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function getWidth(): int |
|
121
|
|
|
{ |
|
122
|
|
|
return $this->width; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function setWidth(int $width): void |
|
126
|
|
|
{ |
|
127
|
|
|
$this->width = $width; |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getCreatedAt(): \DateTimeImmutable |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->createdAt; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function setCreatedAt(\DateTimeImmutable $createdAt): void |
|
136
|
|
|
{ |
|
137
|
|
|
$this->createdAt = $createdAt; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getUpdatedAt(): \DateTimeImmutable |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->updatedAt; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function setUpdatedAt(\DateTimeImmutable $updatedAt): void |
|
146
|
|
|
{ |
|
147
|
|
|
$this->updatedAt = $updatedAt; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function getImageUrl(string $size = 'logo_med'): string |
|
151
|
|
|
{ |
|
152
|
|
|
return "https://images.igdb.com/igdb/image/upload/t_{$size}/{$this->imageId}.png"; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
public function __toString(): string |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->imageId . ' (' . $this->width . 'x' . $this->height . ')'; |
|
158
|
|
|
} |
|
159
|
|
|
} |
|
160
|
|
|
|