FileFactory::definition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 15
rs 9.8666
1
<?php
2
3
namespace SaasReady\Database\Factories;
4
5
use Illuminate\Database\Eloquent\Factories\Factory;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Factories\Factory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Http\UploadedFile;
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\UploadedFile was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use SaasReady\Models\Currency;
0 ignored issues
show
Bug introduced by
The type SaasReady\Models\Currency was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use SaasReady\Models\File;
9
10
class FileFactory extends Factory
11
{
12
    protected $model = File::class;
13
14
    public function definition(): array
15
    {
16
        $fakeFile = UploadedFile::fake()
17
            ->create($this->faker->slug() . '.txt');
18
19
        return [
20
            'model_id' => fn () => Currency::factory()->create(),
21
            'model_type' => Currency::class,
22
            'category' => $this->faker->creditCardType(),
23
            'filename' => $fakeFile->getBasename(),
24
            'original_filename' => $fakeFile->getBasename(),
25
            'path' => $fakeFile->path(),
26
            'size' => $fakeFile->getSize(),
27
            'mime_type' => 'text/plain',
28
            'source' => 'local',
29
        ];
30
    }
31
}
32