TokenFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A definition() 0 8 1
1
<?php
2
3
namespace Bmatovu\MtnMomo\Database\Factories;
4
5
use Bmatovu\MtnMomo\Models\Token;
6
use Illuminate\Database\Eloquent\Factories\Factory;
7
use Illuminate\Support\Str;
8
9
class TokenFactory extends Factory
10
{
11
    /**
12
     * The name of the factory's corresponding model.
13
     *
14
     * @var string
15
     */
16
    protected $model = Token::class;
17
18
    /**
19
     * Define the model's default state.
20
     *
21
     * @return array
22
     */
23
    public function definition()
24
    {
25
        return [
26
            'access_token' => Str::random(60),
27
            'refresh_token' => Str::random(60),
28
            '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

28
            '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...
29
            'product' => $this->faker->randomElement(['collection', 'disbursement', 'remittance']),
30
            'expires_at' => $this->faker->dateTime('now', null),
31
        ];
32
    }
33
}
34