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

BeforeCopySubtreeEvent   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 getSubtree() 0 4 1
A getTargetParentLocation() 0 4 1
A getLocation() 0 4 1
A setLocation() 0 4 1
A hasLocation() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace eZ\Publish\Core\Event\Location;
6
7
use eZ\Publish\API\Repository\Values\Content\Location;
8
use eZ\Publish\Core\Event\BeforeEvent;
9
10
final class BeforeCopySubtreeEvent extends BeforeEvent
11
{
12
	public const NAME = 'ezplatform.event.location.copy_subtree.before';
13
14
	/**
15
     * @var \eZ\Publish\API\Repository\Values\Content\Location
16
     */
17
	private $subtree;
18
19
	/**
20
     * @var \eZ\Publish\API\Repository\Values\Content\Location
21
     */
22
	private $targetParentLocation;
23
24
	/**
25
     * @var \eZ\Publish\API\Repository\Values\Content\Location|null
26
     */
27
	private $location;
28
29
30
	public function __construct(Location $subtree, Location $targetParentLocation)
31
	{
32
		$this->subtree = $subtree;
33
		$this->targetParentLocation = $targetParentLocation;
34
	}
35
36
37
	public function getSubtree(): Location
38
	{
39
		return $this->subtree;
40
	}
41
42
43
	public function getTargetParentLocation(): Location
44
	{
45
		return $this->targetParentLocation;
46
	}
47
48
49
	function getLocation(): ?Location
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...
50
	{
51
		return $this->location;
52
	}
53
54
55
	function setLocation(?Location $location): 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...
56
	{
57
		$this->location = $location;
58
	}
59
60
61
	function hasLocation(): 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...
62
	{
63
		return $this->location instanceof Location;
64
	}
65
}
66