Completed
Pull Request — master (#4216)
by Craig
05:32
created

ExtensionPreStateChangeEvent   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getNewState() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula Foundation - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\ExtensionsModule\Event;
15
16
use Zikula\ExtensionsModule\Entity\ExtensionEntity;
17
18
/**
19
 * Occurs before updating the state of an extension. The event itself cannot affect the workflow unless
20
 * an exception is thrown to completely halt. For example, performing a permissions check.
21
 */
22
class ExtensionPreStateChangeEvent extends ExtensionEntityEvent
23
{
24
    /**
25
     * The intended new state for the extension.
26
     * @var int
27
     */
28
    private $newState;
29
30
    public function __construct(ExtensionEntity $extensionEntity, int $newState)
31
    {
32
        parent::__construct($extensionEntity);
33
        $this->newState = $newState;
34
    }
35
36
    public function getNewState(): int
37
    {
38
        return $this->newState;
39
    }
40
}
41