Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| DefaultMessageFactory | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 1 |
| getLtiMessage | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
30 | |||
| 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) 2018 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\ltiDeliveryProvider\model\navigation; |
| 23 | |
| 24 | use oat\oatbox\service\ConfigurableService; |
| 25 | use oat\taoDelivery\model\execution\DeliveryExecutionInterface; |
| 26 | use oat\taoLti\models\classes\LtiMessages\LtiMessage; |
| 27 | |
| 28 | class DefaultMessageFactory extends ConfigurableService implements LtiMessageFactoryInterface |
| 29 | { |
| 30 | /** |
| 31 | * @param DeliveryExecutionInterface $deliveryExecution |
| 32 | * @return LtiMessage |
| 33 | * @throws \common_exception_NotFound |
| 34 | */ |
| 35 | public function getLtiMessage(DeliveryExecutionInterface $deliveryExecution): LtiMessage |
| 36 | { |
| 37 | $state = $deliveryExecution->getState(); |
| 38 | $code = null; |
| 39 | switch ($state->getUri()) { |
| 40 | case DeliveryExecutionInterface::STATE_ACTIVE: |
| 41 | $code = 100; |
| 42 | break; |
| 43 | case DeliveryExecutionInterface::STATE_PAUSED: |
| 44 | $code = 101; |
| 45 | break; |
| 46 | case DeliveryExecutionInterface::STATE_FINISHED: |
| 47 | $code = 200; |
| 48 | break; |
| 49 | case DeliveryExecutionInterface::STATE_TERMINATED: |
| 50 | $code = 201; |
| 51 | break; |
| 52 | } |
| 53 | return new LtiMessage('', $code); |
| 54 | } |
| 55 | } |