| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class TemporaryUploadFactory |
||
| 11 | { |
||
| 12 | private int $fakeImageWidth = 10; |
||
| 13 | private int $fakeImageHeight = 10; |
||
| 14 | |||
| 15 | public static function new(): self |
||
| 18 | } |
||
| 19 | |||
| 20 | public function useFakeImageDimensions(int $fakeImageWidth, int $fakeImageHeight): self |
||
| 21 | { |
||
| 22 | $this->fakeImageWidth = $fakeImageWidth; |
||
| 23 | |||
| 24 | $this->fakeImageHeight = $fakeImageHeight; |
||
| 25 | |||
| 26 | return $this; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function create(array $attributes = []): TemporaryUpload |
||
| 30 | { |
||
| 31 | $fakeUpload = UploadedFile::fake()->image('test.jpg', $this->fakeImageWidth, $this->fakeImageHeight); |
||
| 32 | |||
| 33 | return TemporaryUpload::createForFile( |
||
| 34 | $fakeUpload, |
||
| 35 | session()->getId(), |
||
| 36 | $attributes['uuid'] ?? Str::uuid(), |
||
| 37 | $attributes['name'] ?? 'name', |
||
| 38 | ); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function createMultiple(int $count, array $attributes = []): array |
||
| 45 | } |
||
| 46 | } |
||
| 47 |