RecipientFactory::definition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Database\Factories\Squareetlabs\VeriFactu\Models;
6
7
use Illuminate\Database\Eloquent\Factories\Factory;
8
use Squareetlabs\VeriFactu\Models\Recipient;
9
10
class RecipientFactory extends Factory
11
{
12
    protected $model = Recipient::class;
13
14
    public function definition(): array
15
    {
16
        return [
17
            'name' => $this->faker->name,
18
            'tax_id' => strtoupper($this->faker->bothify('C########')),
19
            'country' => $this->faker->countryCode,
20
            'address' => $this->faker->address,
21
            'email' => $this->faker->optional()->safeEmail,
22
            'phone' => $this->faker->optional()->phoneNumber,
23
            'type' => $this->faker->optional()->randomElement(['VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED']),
0 ignored issues
show
Bug introduced by
The call to Faker\Generator::randomElement() has too few arguments starting with 'b'. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
            'type' => $this->faker->optional()->/** @scrutinizer ignore-call */ randomElement(['VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED']),

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
24
        ];
25
    }
26
}