PageSettingFactory::setData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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