Passed
Push — feature/publishable ( ce6968...c26268 )
by Daniel
13:37
created

PublishableTrait::getPublishedResource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component 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\ApiComponentBundle\Entity\Utility;
15
16
/**
17
 * @author Vincent Chalamon <[email protected]>
18
 */
19
trait PublishableTrait
20
{
21
    // Needs to be protected instead of published so reflection can read property when merging draft into published
22
    protected ?\DateTimeInterface $publishedAt = null;
23
24
    protected ?self $publishedResource = null;
25
26
    protected ?self $draftResource = null;
27
28
    /** @return static */
29
    public function setPublishedAt(?\DateTimeInterface $publishedAt)
30
    {
31
        $this->publishedAt = $publishedAt;
32
33
        return $this;
34
    }
35
36
    public function getPublishedAt(): ?\DateTimeInterface
37
    {
38
        return $this->publishedAt;
39
    }
40
41
    /** @return static */
42
    public function setPublishedResource($publishedResource)
43
    {
44
        $this->publishedResource = $publishedResource;
45
46
        return $this;
47
    }
48
49
    public function getPublishedResource(): ?self
50
    {
51
        return $this->publishedResource;
52
    }
53
54
    public function getDraftResource(): ?self
55
    {
56
        return $this->draftResource;
57
    }
58
}
59