Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       0.00%  | 
       0 / 10  | 
               | 
       0.00%  | 
       0 / 4  | 
       CRAP |         | 
       0.00%  | 
       0 / 1  | 
      
| LtiMessage |         | 
       0.00%  | 
       0 / 10  | 
               | 
       0.00%  | 
       0 / 4  | 
       42 |         | 
       0.00%  | 
       0 / 1  | 
      
| __construct |         | 
       0.00%  | 
       0 / 2  | 
               | 
       0.00%  | 
       0 / 1  | 
       2 | |||
| getMessage |         | 
       0.00%  | 
       0 / 1  | 
               | 
       0.00%  | 
       0 / 1  | 
       2 | |||
| getLog |         | 
       0.00%  | 
       0 / 1  | 
               | 
       0.00%  | 
       0 / 1  | 
       2 | |||
| getUrlParams |         | 
       0.00%  | 
       0 / 6  | 
               | 
       0.00%  | 
       0 / 1  | 
       12 | |||
| 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 | |
| 22 | namespace oat\taoLti\models\classes\LtiMessages; | 
| 23 | |
| 24 | /** | 
| 25 | * Class LtiMessage | 
| 26 | * | 
| 27 | * Class represents message and log values to be used in the return url (launch_presentation_return_url) | 
| 28 | * | 
| 29 | * @see http://www.imsglobal.org/specs/ltiv1p0/implementation-guide#toc-3 - "launch_presentation_return_url" section | 
| 30 | * @package oat\taoLti\models\classes\LtiMessages | 
| 31 | * @author Aleh Hutnikau, <hutnikau@1pt.com> | 
| 32 | */ | 
| 33 | class LtiMessage | 
| 34 | { | 
| 35 | /** | 
| 36 | * @var string | 
| 37 | */ | 
| 38 | protected $log; | 
| 39 | |
| 40 | /** | 
| 41 | * @var string | 
| 42 | */ | 
| 43 | protected $message; | 
| 44 | |
| 45 | /** | 
| 46 | * LtiMessage constructor. | 
| 47 | * @param $message | 
| 48 | * @param $log | 
| 49 | */ | 
| 50 | public function __construct($message, $log) | 
| 51 | { | 
| 52 | $this->message = $message; | 
| 53 | $this->log = $log; | 
| 54 | } | 
| 55 | |
| 56 | /** | 
| 57 | * @return string | 
| 58 | */ | 
| 59 | public function getMessage() | 
| 60 | { | 
| 61 | return $this->message; | 
| 62 | } | 
| 63 | |
| 64 | /** | 
| 65 | * @return string | 
| 66 | */ | 
| 67 | public function getLog() | 
| 68 | { | 
| 69 | return $this->log; | 
| 70 | } | 
| 71 | |
| 72 | /** | 
| 73 | * @return array | 
| 74 | */ | 
| 75 | public function getUrlParams() | 
| 76 | { | 
| 77 | $params = []; | 
| 78 | if (!empty($this->getMessage())) { | 
| 79 | $params['lti_msg'] = $this->getMessage(); | 
| 80 | } | 
| 81 | if (!empty($this->getLog())) { | 
| 82 | $params['lti_log'] = $this->getLog(); | 
| 83 | } | 
| 84 | return $params; | 
| 85 | } | 
| 86 | } |