Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
DeliveryExecutionFinished
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDeliveryExecution
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getWebhookEventName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 serializeForWebhook
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
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) 2017 (original work) Open Assessment Technologies SA;
19 *
20 */
21
22namespace oat\taoProctoring\model\event;
23
24use oat\tao\model\webhooks\WebhookSerializableEventInterface;
25use oat\taoDelivery\model\execution\DeliveryExecution;
26
27/**
28 * This event is fired whenever a delivery execution goes to the `finished` state
29 */
30class DeliveryExecutionFinished implements WebhookSerializableEventInterface
31{
32    public const EVENT_NAME = self::class;
33    public const WEBHOOK_EVENT_NAME = 'DeliveryExecutionFinished';
34
35    /**
36     * @var DeliveryExecution
37     */
38    private $deliveryExecution;
39
40    /**
41     * @return string
42     */
43    public function getName()
44    {
45        return self::EVENT_NAME;
46    }
47
48    /**
49     * @param DeliveryExecution $deliveryExecution
50     */
51    public function __construct(DeliveryExecution $deliveryExecution)
52    {
53        $this->deliveryExecution = $deliveryExecution;
54    }
55
56    /**
57     * Returns the finished delivery execution instance
58     *
59     * @return DeliveryExecution
60     */
61    public function getDeliveryExecution()
62    {
63        return $this->deliveryExecution;
64    }
65
66    /**
67     * @return string
68     */
69    public function getWebhookEventName()
70    {
71        return self::WEBHOOK_EVENT_NAME;
72    }
73
74    /**
75     * @return array
76     */
77    public function serializeForWebhook()
78    {
79        return [
80            'deliveryExecutionId' => $this->deliveryExecution->getIdentifier()
81        ];
82    }
83}