Skip to content

Commit 314e9f4

Browse files
committed
refactor: renames data to base64Data
1 parent b7b7b63 commit 314e9f4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Files/DTO/File.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class File implements WithJsonSchemaInterface
3636
/**
3737
* @var string|null The base64 data for inline files.
3838
*/
39-
private ?string $data = null;
39+
private ?string $base64Data = null;
4040

4141
/**
4242
* Constructor.
@@ -78,7 +78,7 @@ private function detectAndProcessFile(string $file, ?string $providedMimeType):
7878

7979
if (preg_match($dataUriPattern, $file, $matches)) {
8080
$this->fileType = FileTypeEnum::inline();
81-
$this->data = $matches[2]; // Extract just the base64 data
81+
$this->base64Data = $matches[2]; // Extract just the base64 data
8282
$extractedMimeType = empty($matches[1]) ? null : $matches[1];
8383
$this->mimeType = $this->determineMimeType($providedMimeType, $extractedMimeType, null);
8484
return;
@@ -92,15 +92,15 @@ private function detectAndProcessFile(string $file, ?string $providedMimeType):
9292
);
9393
}
9494
$this->fileType = FileTypeEnum::inline();
95-
$this->data = $file;
95+
$this->base64Data = $file;
9696
$this->mimeType = new MimeType($providedMimeType);
9797
return;
9898
}
9999

100100
// If none of the above, assume it's a local file path
101101
if (file_exists($file)) {
102102
$this->fileType = FileTypeEnum::inline();
103-
$this->data = $this->convertFileToBase64($file);
103+
$this->base64Data = $this->convertFileToBase64($file);
104104
$this->mimeType = $this->determineMimeType($providedMimeType, null, $file);
105105
return;
106106
}
@@ -179,7 +179,7 @@ public function getUrl(): ?string
179179
*/
180180
public function getBase64Data(): ?string
181181
{
182-
return $this->data;
182+
return $this->base64Data;
183183
}
184184

185185
/**
@@ -191,11 +191,11 @@ public function getBase64Data(): ?string
191191
*/
192192
public function getDataUri(): ?string
193193
{
194-
if ($this->data === null) {
194+
if ($this->base64Data === null) {
195195
return null;
196196
}
197197

198-
return sprintf('data:%s;base64,%s', $this->getMimeType(), $this->data);
198+
return sprintf('data:%s;base64,%s', $this->getMimeType(), $this->base64Data);
199199
}
200200

201201
/**

0 commit comments

Comments
 (0)