BreakdownFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 13
c 1
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A definition() 0 13 1
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\Breakdown;
9
use Squareetlabs\VeriFactu\Enums\TaxType;
10
use Squareetlabs\VeriFactu\Enums\RegimeType;
11
use Squareetlabs\VeriFactu\Enums\OperationType;
12
13
class BreakdownFactory extends Factory
14
{
15
    protected $model = Breakdown::class;
16
17
    public function definition(): array
18
    {
19
        return [
20
            'tax_type' => $this->faker->randomElement(array_column(TaxType::cases(), 'value')),
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

20
            'tax_type' => $this->faker->/** @scrutinizer ignore-call */ randomElement(array_column(TaxType::cases(), 'value')),

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...
21
            'regime_type' => $this->faker->randomElement(array_column(RegimeType::cases(), 'value')),
22
            'operation_type' => $this->faker->randomElement(array_column(OperationType::cases(), 'value')),
23
            'tax_rate' => $this->faker->randomFloat(2, 0, 21),
24
            'base_amount' => $this->faker->randomFloat(2, 100, 1000),
25
            'tax_amount' => $this->faker->randomFloat(2, 10, 200),
26
            'equivalence_surcharge_rate' => $this->faker->optional()->randomFloat(2, 0, 5),
27
            'equivalence_surcharge_amount' => $this->faker->optional()->randomFloat(2, 0, 50),
28
            'exemption_code' => $this->faker->optional()->bothify('E#'),
29
            'exemption_description' => $this->faker->optional()->sentence,
30
        ];
31
    }
32
}