Completed
Push — ezp-30616 ( ab7e14...128c78 )
by
unknown
17:09
created

BeforeCreateContentDraftEvent::getContentDraft()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace eZ\Publish\Core\Event\Content;
6
7
use eZ\Publish\API\Repository\Values\Content\Content;
8
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
9
use eZ\Publish\API\Repository\Values\Content\VersionInfo;
10
use eZ\Publish\API\Repository\Values\User\User;
11
use eZ\Publish\Core\Event\BeforeEvent;
12
13
final class BeforeCreateContentDraftEvent extends BeforeEvent
14
{
15
	public const NAME = 'ezplatform.event.content.draft_create.before';
16
17
	/**
18
     * @var \eZ\Publish\API\Repository\Values\Content\ContentInfo
19
     */
20
	private $contentInfo;
21
22
	/**
23
     * @var \eZ\Publish\API\Repository\Values\Content\VersionInfo
24
     */
25
	private $versionInfo;
26
27
	/**
28
     * @var \eZ\Publish\API\Repository\Values\User\User
29
     */
30
	private $creator;
31
32
	/**
33
     * @var \eZ\Publish\API\Repository\Values\Content\Content|null
34
     */
35
	private $contentDraft;
36
37
38
	public function __construct(ContentInfo $contentInfo, VersionInfo $versionInfo, User $creator)
39
	{
40
		$this->contentInfo = $contentInfo;
41
		$this->versionInfo = $versionInfo;
42
		$this->creator = $creator;
43
	}
44
45
46
	public function getContentInfo(): ContentInfo
47
	{
48
		return $this->contentInfo;
49
	}
50
51
52
	public function getVersionInfo(): VersionInfo
53
	{
54
		return $this->versionInfo;
55
	}
56
57
58
	public function getCreator(): User
59
	{
60
		return $this->creator;
61
	}
62
63
64
	function getContentDraft(): ?Content
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
65
	{
66
		return $this->contentDraft;
67
	}
68
69
70
	function setContentDraft(?Content $contentDraft): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
71
	{
72
		$this->contentDraft = $contentDraft;
73
	}
74
75
76
	function hasContentDraft(): bool
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
77
	{
78
		return $this->contentDraft instanceof Content;
79
	}
80
}
81