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

BeforeTranslateEvent::setResult()   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\URLWildcard;
6
7
use eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult;
8
use eZ\Publish\Core\Event\BeforeEvent;
9
10
final class BeforeTranslateEvent extends BeforeEvent
11
{
12
	public const NAME = 'ezplatform.event.url_wildcard.translate.before';
13
14
	private $url;
15
16
	/**
17
     * @var \eZ\Publish\API\Repository\Values\Content\URLWildcardTranslationResult|null
18
     */
19
	private $result;
20
21
22
	public function __construct($url)
23
	{
24
		$this->url = $url;
25
	}
26
27
28
	public function getUrl()
29
	{
30
		return $this->url;
31
	}
32
33
34
	function getResult(): ?URLWildcardTranslationResult
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...
35
	{
36
		return $this->result;
37
	}
38
39
40
	function setResult(?URLWildcardTranslationResult $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...
41
	{
42
		$this->result = $result;
43
	}
44
45
46
	function hasResult(): 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...
47
	{
48
		return $this->result instanceof URLWildcardTranslationResult;
49
	}
50
}
51