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

BeforePublishVersionEvent::setContent()   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 1
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\VersionInfo;
9
use eZ\Publish\Core\Event\BeforeEvent;
10
11
final class BeforePublishVersionEvent extends BeforeEvent
12
{
13
	public const NAME = 'ezplatform.event.version.publish.before';
14
15
	/**
16
     * @var \eZ\Publish\API\Repository\Values\Content\VersionInfo
17
     */
18
	private $versionInfo;
19
20
	/**
21
     * @var \eZ\Publish\API\Repository\Values\Content\Content|null
22
     */
23
	private $content;
24
25
26
	public function __construct(VersionInfo $versionInfo)
27
	{
28
		$this->versionInfo = $versionInfo;
29
	}
30
31
32
	public function getVersionInfo(): VersionInfo
33
	{
34
		return $this->versionInfo;
35
	}
36
37
38
	function getContent(): ?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...
39
	{
40
		return $this->content;
41
	}
42
43
44
	function setContent(?Content $content): 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...
45
	{
46
		$this->content = $content;
47
	}
48
49
50
	function hasContent(): 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...
51
	{
52
		return $this->content instanceof Content;
53
	}
54
}
55