Test Failed
Push — master ( 2c2c87...ed1c51 )
by Chris
25:05 queued 37s
created

SettingsSectionBuilder::constraints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Leonidas\Library\Admin\Page\SettingsSection;
4
5
use Leonidas\Contracts\Admin\Components\SettingsSectionBuilderInterface;
6
use Leonidas\Contracts\Admin\Components\SettingsSectionInterface;
7
use Leonidas\Contracts\Http\ConstrainerCollectionInterface;
8
use Leonidas\Library\Admin\Page\SettingsSection;
9
use Leonidas\Library\Admin\Page\SettingsSection\Traits\HasSettingsSectionDataTrait;
10
11
class SettingsSectionBuilder implements SettingsSectionBuilderInterface
12
{
13
    use HasSettingsSectionDataTrait;
14
15
    public function __construct(string $id)
16
    {
17
        $this->id = $id;
18
    }
19
20
    public function id(string $id)
21
    {
22
        $this->id = $id;
23
    }
24
25
    public function title(string $title)
26
    {
27
        $this->title = $title;
28
    }
29
30
    public function page(string $page)
31
    {
32
        $this->page = $page;
33
    }
34
35
    public function description(string $description)
36
    {
37
        $this->description = $description;
38
    }
39
40
    public function constraints(?ConstrainerCollectionInterface $constraints)
41
    {
42
        $this->constraints = $constraints;
0 ignored issues
show
Bug Best Practice introduced by
The property constraints does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
43
    }
44
45
    public function getConstraints(): ?ConstrainerCollectionInterface
46
    {
47
        return $this->constraints;
48
    }
49
50
    public function get(): SettingsSectionInterface
51
    {
52
        return new SettingsSection(
53
            $this->getId(),
54
            $this->getTitle(),
55
            $this->getPage(),
56
            $this->getDescription(),
57
            $this->getConstraints(),
58
        );
59
    }
60
}
61