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

BeforeCreateObjectStateEvent   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 56
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getObjectStateGroup() 0 4 1
A getObjectStateCreateStruct() 0 4 1
A getObjectState() 0 4 1
A setObjectState() 0 4 1
A hasObjectState() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace eZ\Publish\Core\Event\ObjectState;
6
7
use eZ\Publish\API\Repository\Values\ObjectState\ObjectState;
8
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct;
9
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup;
10
use eZ\Publish\Core\Event\BeforeEvent;
11
12
final class BeforeCreateObjectStateEvent extends BeforeEvent
13
{
14
	public const NAME = 'ezplatform.event.object_state.create.before';
15
16
	/**
17
     * @var \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
18
     */
19
	private $objectStateGroup;
20
21
	/**
22
     * @var \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateCreateStruct
23
     */
24
	private $objectStateCreateStruct;
25
26
	/**
27
     * @var \eZ\Publish\API\Repository\Values\ObjectState\ObjectState|null
28
     */
29
	private $objectState;
30
31
32
	public function __construct(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct)
33
	{
34
		$this->objectStateGroup = $objectStateGroup;
35
		$this->objectStateCreateStruct = $objectStateCreateStruct;
36
	}
37
38
39
	public function getObjectStateGroup(): ObjectStateGroup
40
	{
41
		return $this->objectStateGroup;
42
	}
43
44
45
	public function getObjectStateCreateStruct(): ObjectStateCreateStruct
46
	{
47
		return $this->objectStateCreateStruct;
48
	}
49
50
51
	function getObjectState(): ?ObjectState
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...
52
	{
53
		return $this->objectState;
54
	}
55
56
57
	function setObjectState(?ObjectState $objectState): 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...
58
	{
59
		$this->objectState = $objectState;
60
	}
61
62
63
	function hasObjectState(): 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...
64
	{
65
		return $this->objectState instanceof ObjectState;
66
	}
67
}
68