|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Silverback\ApiComponentBundle\DTO\File; |
|
4
|
|
|
|
|
5
|
|
|
use Silverback\ApiComponentBundle\DTO\File\ImageMetadata; |
|
6
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class FileData |
|
10
|
|
|
* @package Silverback\ApiComponentBundle\Entity\Content |
|
11
|
|
|
* This class is to hold data about a file and is added into a File component during serialization |
|
12
|
|
|
*/ |
|
13
|
|
|
class FileData |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @Groups({"component", "content"}) |
|
17
|
|
|
* @var string|null |
|
18
|
|
|
*/ |
|
19
|
|
|
private $publicPath; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @Groups({"component", "content"}) |
|
23
|
|
|
* @var \Silverback\ApiComponentBundle\DTO\File\ImageMetadata|null |
|
24
|
|
|
*/ |
|
25
|
|
|
private $imageData; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @Groups({"component", "content"}) |
|
29
|
|
|
* @var \Silverback\ApiComponentBundle\DTO\File\ImageMetadata[]|null |
|
30
|
|
|
*/ |
|
31
|
|
|
private $imagineData; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* FileData constructor. |
|
35
|
|
|
* @param null|string $publicPath |
|
36
|
|
|
* @param null|\Silverback\ApiComponentBundle\DTO\File\ImageMetadata $imageData |
|
37
|
|
|
* @param null|\Silverback\ApiComponentBundle\DTO\File\ImageMetadata[] $imagineData |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct(?string $publicPath, ?ImageMetadata $imageData, ?array $imagineData) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->publicPath = $publicPath; |
|
42
|
|
|
$this->imageData = $imageData; |
|
43
|
|
|
$this->imagineData = $imagineData; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @return null|string |
|
48
|
|
|
*/ |
|
49
|
|
|
public function getPublicPath(): ?string |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->publicPath; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return null|\Silverback\ApiComponentBundle\DTO\File\ImageMetadata |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getImageData(): ?ImageMetadata |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->imageData; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return null|\Silverback\ApiComponentBundle\DTO\File\ImageMetadata[] |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getImagineData(): ?array |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->imagineData; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|