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

BeforeTrashEvent::isResultSet()   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\Trash;
6
7
use eZ\Publish\API\Repository\Values\Content\Location;
8
use eZ\Publish\API\Repository\Values\Content\TrashItem;
9
use eZ\Publish\Core\Event\BeforeEvent;
10
11
final class BeforeTrashEvent extends BeforeEvent
12
{
13
	public const NAME = 'ezplatform.event.trash.before';
14
15
	/**
16
     * @var \eZ\Publish\API\Repository\Values\Content\Location
17
     */
18
	private $location;
19
20
	/**
21
     * @var \eZ\Publish\API\Repository\Values\Content\TrashItem|null
22
     */
23
	private $result;
24
25
    /**
26
     * @var bool
27
     */
28
	private $resultSet = false;
29
30
31
	public function __construct(Location $location)
32
	{
33
		$this->location = $location;
34
	}
35
36
37
	public function getLocation(): Location
38
	{
39
		return $this->location;
40
	}
41
42
43
	function getResult(): ?TrashItem
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...
44
	{
45
		return $this->result;
46
	}
47
48
49
	function setResult(?TrashItem $result): 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...
50
	{
51
		$this->result = $result;
52
		$this->resultSet = true;
53
	}
54
55
	function hasTrashItem(): 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...
56
	{
57
		return $this->result instanceof TrashItem;
58
	}
59
60
	function resetResult(): 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...
61
    {
62
        $this->result = null;
63
        $this->resultSet = false;
64
    }
65
66
	function isResultSet(): 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...
67
    {
68
        return $this->resultSet;
69
    }
70
}
71