Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
44.44% |
4 / 9 |
|
16.67% |
1 / 6 |
CRAP | |
0.00% |
0 / 1 |
| DeliveryExecutionState | |
44.44% |
4 / 9 |
|
16.67% |
1 / 6 |
12.17 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getDeliveryExecution | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getState | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPreviousState | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getContext | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2015-2021 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\taoDelivery\models\classes\execution\event; |
| 23 | |
| 24 | use oat\oatbox\event\Event; |
| 25 | use oat\tao\model\Context\ContextInterface; |
| 26 | use oat\taoDelivery\model\execution\DeliveryExecutionInterface; |
| 27 | |
| 28 | /** |
| 29 | * Event should be triggered after changing delivery execution state. |
| 30 | * |
| 31 | * @author Aleh Hutnikau <hutnikau@1pt.com> |
| 32 | */ |
| 33 | class DeliveryExecutionState implements Event |
| 34 | { |
| 35 | /** |
| 36 | * @var DeliveryExecutionInterface delivery execution instance |
| 37 | */ |
| 38 | private $deliveryExecution; |
| 39 | /** |
| 40 | * @var string state name |
| 41 | */ |
| 42 | private $state; |
| 43 | /** |
| 44 | * @var string previous state name |
| 45 | */ |
| 46 | private $prevState; |
| 47 | |
| 48 | /** @var ContextInterface|null */ |
| 49 | private $context; |
| 50 | |
| 51 | public function __construct( |
| 52 | DeliveryExecutionInterface $deliveryExecution, |
| 53 | string $state, |
| 54 | string $prevState = null, |
| 55 | ContextInterface $context = null |
| 56 | ) { |
| 57 | $this->deliveryExecution = $deliveryExecution; |
| 58 | $this->state = $state; |
| 59 | $this->prevState = $prevState; |
| 60 | $this->context = $context; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @return DeliveryExecutionInterface |
| 65 | */ |
| 66 | public function getDeliveryExecution() |
| 67 | { |
| 68 | return $this->deliveryExecution; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @return string |
| 73 | */ |
| 74 | public function getState() |
| 75 | { |
| 76 | return $this->state; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * @return null|string |
| 81 | */ |
| 82 | public function getPreviousState() |
| 83 | { |
| 84 | return $this->prevState; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @return string |
| 89 | */ |
| 90 | public function getName() |
| 91 | { |
| 92 | return __CLASS__; |
| 93 | } |
| 94 | |
| 95 | public function getContext(): ?ContextInterface |
| 96 | { |
| 97 | return $this->context; |
| 98 | } |
| 99 | } |