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

BeforeTranslateEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getUrl() 0 4 1
A getResult() 0 4 1
A setResult() 0 4 1
A hasResult() 0 4 1
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