@@ -29,9 +29,14 @@ class File implements WithJsonSchemaInterface
29
29
private FileTypeEnum $ fileType ;
30
30
31
31
/**
32
- * @var string The file data ( URL for remote, base64 for inline) .
32
+ * @var string|null The URL for remote files .
33
33
*/
34
- private string $ data ;
34
+ private ?string $ url = null ;
35
+
36
+ /**
37
+ * @var string|null The base64 data for inline files.
38
+ */
39
+ private ?string $ data = null ;
35
40
36
41
/**
37
42
* Constructor.
@@ -62,7 +67,7 @@ private function detectAndProcessFile(string $file, ?string $providedMimeType):
62
67
// Check if it's a URL
63
68
if ($ this ->isUrl ($ file )) {
64
69
$ this ->fileType = FileTypeEnum::remote ();
65
- $ this ->data = $ file ;
70
+ $ this ->url = $ file ;
66
71
$ this ->mimeType = $ this ->determineMimeType ($ providedMimeType , null , $ file );
67
72
return ;
68
73
}
@@ -162,11 +167,7 @@ public function getFileType(): FileTypeEnum
162
167
*/
163
168
public function getUrl (): ?string
164
169
{
165
- if (!$ this ->fileType ->isRemote ()) {
166
- return null ;
167
- }
168
-
169
- return $ this ->data ;
170
+ return $ this ->url ;
170
171
}
171
172
172
173
/**
@@ -178,10 +179,6 @@ public function getUrl(): ?string
178
179
*/
179
180
public function getBase64Data (): ?string
180
181
{
181
- if (!$ this ->fileType ->isInline ()) {
182
- return null ;
183
- }
184
-
185
182
return $ this ->data ;
186
183
}
187
184
@@ -194,7 +191,7 @@ public function getBase64Data(): ?string
194
191
*/
195
192
public function getDataUri (): ?string
196
193
{
197
- if (! $ this ->fileType -> isInline () ) {
194
+ if ($ this ->data === null ) {
198
195
return null ;
199
196
}
200
197
0 commit comments