Passed
Push — main ( c81305...16cc9f )
by Daniel
15:49 queued 17s
created

ResourceMetadata::getPersisted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentsBundle\Serializer\ResourceMetadata;
15
16
use Silverback\ApiComponentsBundle\Metadata\PageDataMetadata;
17
use Symfony\Component\Serializer\Annotation\Groups;
18
use Symfony\Component\Validator\ConstraintViolationListInterface;
19
20
class ResourceMetadata implements ResourceMetadataInterface
21
{
22
    // for page data
23
    #[Groups('cwa_resource:metadata')]
24
    private ?PageDataMetadata $pageDataMetadata = null;
25
26
    // for component position
27
    #[Groups('cwa_resource:metadata')]
28
    private ?string $staticComponent = null;
29
30
    // for component position
31
    #[Groups('cwa_resource:metadata')]
32
    private ?string $pageDataPath = null;
33
34
    #[Groups('cwa_resource:metadata')]
35
    private ?bool $collection = null;
36
37
    #[Groups('cwa_resource:metadata')]
38
    private ?bool $persisted = null;
39
40
    #[Groups('cwa_resource:metadata')]
41
    private ?ResourcePublishableMetadata $publishable = null;
42
43
    #[Groups('cwa_resource:metadata')]
44
    private ?ConstraintViolationListInterface $violationList;
45
46
    #[Groups('cwa_resource:metadata')]
47
    private ?array $mediaObjects = null;
48
49
    #[Groups('cwa_resource:metadata')]
50
    private ?array $mercureSubscribeTopics = null;
51
52
    public function getResourceMetadata(): ?ResourceMetadataInterface
53
    {
54
        return $this;
55
    }
56
57
    public function getPageDataMetadata(): ?PageDataMetadata
58
    {
59
        return $this->pageDataMetadata;
60
    }
61
62
    public function setPageDataMetadata(PageDataMetadata $pageDataMetadata): void
63
    {
64
        $this->pageDataMetadata = $pageDataMetadata;
65
    }
66
67
    public function getStaticComponent(): ?string
68
    {
69
        return $this->staticComponent;
70
    }
71
72
    public function setStaticComponent(string $staticComponentIri): void
73
    {
74
        $this->staticComponent = $staticComponentIri;
75
    }
76
77
    public function getPageDataPath(): ?string
78
    {
79
        return $this->pageDataPath;
80
    }
81
82
    public function setPageDataPath(?string $pageDataPath): void
83
    {
84
        $this->pageDataPath = $pageDataPath;
85
    }
86
87
    public function getCollection(): ?bool
88
    {
89
        return $this->collection;
90
    }
91
92
    public function setCollection(bool $collection): void
93
    {
94
        $this->collection = $collection;
95
    }
96
97 1
    public function getPersisted(): ?bool
98
    {
99 1
        return $this->persisted;
100
    }
101
102 1
    public function setPersisted(?bool $persisted): void
103
    {
104 1
        $this->persisted = $persisted;
105
    }
106
107
    public function getPublishable(): ?ResourcePublishableMetadata
108
    {
109
        return $this->publishable;
110
    }
111
112
    public function setPublishable(bool $published, ?string $publishedAt = null): void
113
    {
114
        if ($this->publishable) {
115
            $this->publishable->published = $published;
116
            $this->publishable->publishedAt = $publishedAt;
117
118
            return;
119
        }
120
        $this->publishable = new ResourcePublishableMetadata($published, $publishedAt);
121
    }
122
123
    public function getViolationList(): ?ConstraintViolationListInterface
124
    {
125
        return $this->violationList;
126
    }
127
128
    public function setViolationList(?ConstraintViolationListInterface $violationList): void
129
    {
130
        $this->violationList = $violationList;
131
    }
132
133
    public function getMediaObjects(): ?array
134
    {
135
        return $this->mediaObjects;
136
    }
137
138
    public function setMediaObjects(array $mediaObjects): void
139
    {
140
        $this->mediaObjects = $mediaObjects;
141
    }
142
143
    public function getMercureSubscribeTopics(): ?array
144
    {
145
        return $this->mercureSubscribeTopics;
146
    }
147
148
    public function setMercureSubscribeTopics(?array $mercureSubscribeTopics): void
149
    {
150
        $this->mercureSubscribeTopics = $mercureSubscribeTopics;
151
    }
152
}
153