TokenFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A definition() 0 7 1
1
<?php
2
3
namespace Bmatovu\AirtelMoney\Database\Factories;
4
5
use Bmatovu\AirtelMoney\Models\Token;
6
use Illuminate\Database\Eloquent\Factories\Factory;
7
use Illuminate\Support\Str;
8
9
/**
10
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\Bmatovu\AirtelMoney\Models\Token>
11
 */
12
class TokenFactory extends Factory
13
{
14
    protected $model = Token::class;
15
16
    /**
17
     * @return array<string, mixed>
18
     */
19
    public function definition(): array
20
    {
21
        return [
22
            'access_token' => Str::random(60),
23
            'refresh_token' => Str::random(60),
24
            'token_type' => $this->faker->randomElement(['Basic', 'Bearer']),
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

24
            'token_type' => $this->faker->/** @scrutinizer ignore-call */ randomElement(['Basic', 'Bearer']),

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...
25
            'expires_at' => $this->faker->dateTime('now', null),
26
        ];
27
    }
28
}
29