PageSettingFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 14
c 1
b 0
f 0
dl 0
loc 43
ccs 19
cts 19
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A page() 0 4 1
A definition() 0 7 1
A setData() 0 5 1
A key() 0 4 1
1
<?php
2
3
namespace Thinkone\NovaPageSettings\Factories;
4
5
use Illuminate\Database\Eloquent\Factories\Factory;
6
use Thinkone\NovaPageSettings\Model\PageSetting;
7
8
/**
9
 * @extends Factory<PageSetting>
10
 */
11
class PageSettingFactory extends Factory
12
{
13
    /**
14
     * The name of the factory's corresponding model.
15
     *
16
     * @var string
17
     */
18
    protected $model = PageSetting::class;
19
20
    /**
21
     * Define the model's default state.
22
     *
23
     * @return array
24
     */
25 2
    public function definition()
26
    {
27 2
        return [
28 2
            'type'  => 'default',
29 2
            'page'  => $this->faker->unique()->word(),
30 2
            'key'   => $this->faker->unique()->word(),
31 2
            'value' => $this->faker->unique()->sentence(),
32 2
        ];
33
    }
34
35 2
    public function page(string $page)
36
    {
37 2
        return $this->state([
38 2
            'page' => $page,
39 2
        ]);
40
    }
41
42 1
    public function key(string $key)
43
    {
44 1
        return $this->state([
45 1
            'key' => $key,
46 1
        ]);
47
    }
48
49 2
    public function setData(string $key, string $value)
50
    {
51 2
        return $this->state([
52 2
            'key'   => $key,
53 2
            'value' => $value,
54 2
        ]);
55
    }
56
}
57