|
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 Illuminate\Support\Str; |
|
9
|
|
|
use Squareetlabs\VeriFactu\Models\Invoice; |
|
10
|
|
|
use Squareetlabs\VeriFactu\Enums\InvoiceType; |
|
11
|
|
|
|
|
12
|
|
|
class InvoiceFactory extends Factory |
|
13
|
|
|
{ |
|
14
|
|
|
protected $model = Invoice::class; |
|
15
|
|
|
|
|
16
|
|
|
public function definition(): array |
|
17
|
|
|
{ |
|
18
|
|
|
return [ |
|
19
|
|
|
'uuid' => $this->faker->uuid, |
|
20
|
|
|
'number' => 'INV-' . $this->faker->unique()->numberBetween(100, 999), |
|
21
|
|
|
'date' => $this->faker->date(), |
|
22
|
|
|
'customer_name' => $this->faker->company, |
|
23
|
|
|
'customer_tax_id' => strtoupper($this->faker->bothify('A########')), |
|
24
|
|
|
'customer_country' => $this->faker->countryCode, |
|
25
|
|
|
'issuer_name' => $this->faker->company, |
|
26
|
|
|
'issuer_tax_id' => strtoupper($this->faker->bothify('B########')), |
|
27
|
|
|
'issuer_country' => $this->faker->countryCode, |
|
28
|
|
|
'amount' => $this->faker->randomFloat(2, 100, 1000), |
|
29
|
|
|
'tax' => $this->faker->randomFloat(2, 10, 200), |
|
30
|
|
|
'total' => $this->faker->randomFloat(2, 110, 1200), |
|
31
|
|
|
'type' => $this->faker->randomElement(array_column(InvoiceType::cases(), 'value')), |
|
|
|
|
|
|
32
|
|
|
'external_reference' => $this->faker->optional()->bothify('EXT-####'), |
|
33
|
|
|
'description' => $this->faker->sentence, |
|
34
|
|
|
'status' => $this->faker->randomElement(['draft', 'sent', 'paid', 'cancelled']), |
|
35
|
|
|
'issued_at' => $this->faker->optional()->dateTimeThisYear(), |
|
36
|
|
|
'cancelled_at' => null, |
|
37
|
|
|
]; |
|
38
|
|
|
} |
|
39
|
|
|
} |
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.