SectionEntryBeforeCreate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getEntry() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the SexyField package.
5
 *
6
 * (c) Dion Snoeijen <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare (strict_types = 1);
13
14
namespace Tardigrades\SectionField\Event;
15
16
use Symfony\Component\EventDispatcher\Event;
17
use Tardigrades\SectionField\Generator\CommonSectionInterface;
18
19
/**
20
 * Class SectionEntryBeforeCreate
21
 *
22
 * This event is dispatched right before the persistance of a section entry.
23
 * It contains the entity so you can use or manipulate it.
24
 *
25
 * @package Tardigrades\SectionField\Event
26
 */
27
class SectionEntryBeforeCreate extends Event
28
{
29
    const NAME = 'section.entry.before.create';
30
31
    /** @var CommonSectionInterface */
32
    protected $entry;
33
34
    public function __construct(CommonSectionInterface $entry)
35
    {
36
        $this->entry = $entry;
37
    }
38
39
    /**
40
     * The entity that is about to be persisted.
41
     */
42
    public function getEntry(): CommonSectionInterface
43
    {
44
        return $this->entry;
45
    }
46
}
47