Skip to content

Commit c19aa8d

Browse files
committed
refactor: removes FileInterface
1 parent 980a880 commit c19aa8d

File tree

3 files changed

+17
-88
lines changed

3 files changed

+17
-88
lines changed

src/Files/Contracts/FileInterface.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/Files/DTO/File.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace WordPress\AiClient\Files\DTO;
66

77
use WordPress\AiClient\Common\Contracts\WithJsonSchemaInterface;
8-
use WordPress\AiClient\Files\Contracts\FileInterface;
98
use WordPress\AiClient\Files\Enums\FileTypeEnum;
109
use WordPress\AiClient\Files\ValueObjects\MimeType;
1110

@@ -17,7 +16,7 @@
1716
*
1817
* @since n.e.x.t
1918
*/
20-
class File implements FileInterface, WithJsonSchemaInterface
19+
class File implements WithJsonSchemaInterface
2120
{
2221
/**
2322
* @var MimeType The MIME type of the file.

src/Results/DTO/GenerativeAiResult.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace WordPress\AiClient\Results\DTO;
66

7-
use WordPress\AiClient\Files\Contracts\FileInterface;
7+
use WordPress\AiClient\Files\DTO\File;
88
use WordPress\AiClient\Messages\DTO\Message;
99
use WordPress\AiClient\Messages\Enums\MessagePartTypeEnum;
1010
use WordPress\AiClient\Results\Contracts\ResultInterface;
@@ -154,10 +154,10 @@ public function toText(): string
154154
*
155155
* @since n.e.x.t
156156
*
157-
* @return FileInterface The file.
157+
* @return File The file.
158158
* @throws \RuntimeException If no file content.
159159
*/
160-
public function toFile(): FileInterface
160+
public function toFile(): File
161161
{
162162
$message = $this->candidates[0]->getMessage();
163163
foreach ($message->getParts() as $part) {
@@ -175,10 +175,10 @@ public function toFile(): FileInterface
175175
*
176176
* @since n.e.x.t
177177
*
178-
* @return FileInterface The image file.
178+
* @return File The image file.
179179
* @throws \RuntimeException If no image content.
180180
*/
181-
public function toImageFile(): FileInterface
181+
public function toImageFile(): File
182182
{
183183
$file = $this->toFile();
184184

@@ -196,10 +196,10 @@ public function toImageFile(): FileInterface
196196
*
197197
* @since n.e.x.t
198198
*
199-
* @return FileInterface The audio file.
199+
* @return File The audio file.
200200
* @throws \RuntimeException If no audio content.
201201
*/
202-
public function toAudioFile(): FileInterface
202+
public function toAudioFile(): File
203203
{
204204
$file = $this->toFile();
205205

@@ -217,10 +217,10 @@ public function toAudioFile(): FileInterface
217217
*
218218
* @since n.e.x.t
219219
*
220-
* @return FileInterface The video file.
220+
* @return File The video file.
221221
* @throws \RuntimeException If no video content.
222222
*/
223-
public function toVideoFile(): FileInterface
223+
public function toVideoFile(): File
224224
{
225225
$file = $this->toFile();
226226

@@ -273,7 +273,7 @@ public function toTexts(): array
273273
*
274274
* @since n.e.x.t
275275
*
276-
* @return FileInterface[] Array of files.
276+
* @return File[] Array of files.
277277
*/
278278
public function toFiles(): array
279279
{
@@ -296,13 +296,13 @@ public function toFiles(): array
296296
*
297297
* @since n.e.x.t
298298
*
299-
* @return FileInterface[] Array of image files.
299+
* @return File[] Array of image files.
300300
*/
301301
public function toImageFiles(): array
302302
{
303303
return array_filter(
304304
$this->toFiles(),
305-
fn(FileInterface $file) => $file->isImage()
305+
fn(File $file) => $file->isImage()
306306
);
307307
}
308308

@@ -311,13 +311,13 @@ public function toImageFiles(): array
311311
*
312312
* @since n.e.x.t
313313
*
314-
* @return FileInterface[] Array of audio files.
314+
* @return File[] Array of audio files.
315315
*/
316316
public function toAudioFiles(): array
317317
{
318318
return array_filter(
319319
$this->toFiles(),
320-
fn(FileInterface $file) => $file->isAudio()
320+
fn(File $file) => $file->isAudio()
321321
);
322322
}
323323

@@ -326,13 +326,13 @@ public function toAudioFiles(): array
326326
*
327327
* @since n.e.x.t
328328
*
329-
* @return FileInterface[] Array of video files.
329+
* @return File[] Array of video files.
330330
*/
331331
public function toVideoFiles(): array
332332
{
333333
return array_filter(
334334
$this->toFiles(),
335-
fn(FileInterface $file) => $file->isVideo()
335+
fn(File $file) => $file->isVideo()
336336
);
337337
}
338338

0 commit comments

Comments
 (0)