Passed
Push — master ( b755a8...4573fd )
by Gabriel
02:16
created

SeoOptions   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 48
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setDescriptionField() 0 5 1
A setOverwriteOnUpdate() 0 5 1
A create() 0 3 1
A setRoutePrefix() 0 5 1
A setTitleField() 0 5 1
A setSlugField() 0 6 1
1
<?php
2
3
namespace Giuga\LaravelSeoMetaBox\Traits;
4
5
class SeoOptions
6
{
7
    public bool $hasSlug = false;
8
    public string $slugField;
9
    public string $titleField;
10
    public string $descriptionField;
11
    public bool $overwriteOnUpdate = false;
12
    public string $routePrefix;
13
14
    public static function create(): self
15
    {
16
        return new static();
17
    }
18
19
    public function setSlugField(string $field): self
20
    {
21
        $this->hasSlug = true;
22
        $this->slugField = $field;
23
24
        return $this;
25
    }
26
27
    public function setRoutePrefix(string $prefix): self
28
    {
29
        $this->routePrefix = $prefix;
30
31
        return $this;
32
    }
33
34
    public function setTitleField(string $field): self
35
    {
36
        $this->titleField = $field;
37
38
        return $this;
39
    }
40
41
    public function setDescriptionField(string $field): self
42
    {
43
        $this->descriptionField = $field;
44
45
        return $this;
46
    }
47
48
    public function setOverwriteOnUpdate(bool $flag = true): self
49
    {
50
        $this->overwriteOnUpdate = $flag;
51
52
        return $this;
53
    }
54
}
55