PublishableTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 38
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getPublishedAt() 0 3 1
A setPublishedResource() 0 5 1
A getDraftResource() 0 3 1
A setPublishedAt() 0 5 1
A getPublishedResource() 0 3 1
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\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