SectionEntryCreated::getEntry()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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 SectionEntryCreated
21
 *
22
 * Dispatched right after all writers have persisted a section entry entity.
23
 *
24
 * @package Tardigrades\SectionField\Event
25
 */
26
class SectionEntryCreated extends Event
27
{
28
    const NAME = 'section.entry.created';
29
30
    /** @var CommonSectionInterface */
31
    protected $entry;
32
33
    /** @var bool */
34
    protected $update;
35
36
    public function __construct(CommonSectionInterface $entry, bool $update)
37
    {
38
        $this->entry = $entry;
39
        $this->update = $update;
40
    }
41
42
    /**
43
     * The Section Entry Entity that was just persisted
44
     */
45
    public function getEntry(): CommonSectionInterface
46
    {
47
        return $this->entry;
48
    }
49
50
    /**
51
     * Was it a create or update action?
52
     *
53
     * @return bool
54
     */
55
    public function getUpdate(): bool
56
    {
57
        return $this->update;
58
    }
59
}
60