Passed
Push — ft/fragments ( 6fc2e4...3b32df )
by Ben
11:43
created

FieldReference::hasFragmentKey()   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 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Thinktomorrow\Chief\Fields;
5
6
class FieldReference
7
{
8
    /** @var string */
9
    private $managerKey;
10
11
    /** @var string */
12
    private $fieldKey;
13
14
    /** @var string */
15
    private $fragmentKey;
16
17
    public function __construct(string $managerKey, string $fieldKey, string $fragmentKey = null)
18
    {
19
        $this->managerKey = $managerKey;
20
        $this->fieldKey = $fieldKey;
21
        $this->fragmentKey = $fragmentKey;
22
    }
23
24
    public function getManagerKey(): string
25
    {
26
        return $this->managerKey;
27
    }
28
29
    public function getFieldKey(): string
30
    {
31
        return $this->fieldKey;
32
    }
33
34
    public function getFragmentKey(): ?string
35
    {
36
        return $this->fragmentKey;
37
    }
38
39
    public function hasFragmentKey(): bool
40
    {
41
        return isset($this->fragmentKey);
42
    }
43
44
    public function toArray(): array
45
    {
46
        return [
47
            'managerKey'  => $this->managerKey,
48
            'fieldKey'    => $this->fieldKey,
49
            'fragmentKey' => $this->fragmentKey,
50
        ];
51
    }
52
}
53