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

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