Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| UnsupportedQtiElement | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getElement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setElement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getUserMessage | |
0.00% |
0 / 3 |
|
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) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\qti\exception; |
| 24 | |
| 25 | use common_exception_UserReadableException; |
| 26 | use DOMElement; |
| 27 | |
| 28 | /** |
| 29 | * Exception thrown when an unsupported QTI class is found. |
| 30 | * |
| 31 | * @access public |
| 32 | * @author Sam, <sam@taotesting.com> |
| 33 | * @package taoQTI |
| 34 | |
| 35 | */ |
| 36 | class UnsupportedQtiElement extends ParsingException implements common_exception_UserReadableException |
| 37 | { |
| 38 | /** |
| 39 | * The element which represents the unsupported QTI class. |
| 40 | * |
| 41 | * @var DOMElement |
| 42 | */ |
| 43 | private $element; |
| 44 | |
| 45 | /** |
| 46 | * Create a new UnsupportedQtiElement object. |
| 47 | * |
| 48 | * @param DOMElement $element The element which represents the unsupported QTI class. |
| 49 | */ |
| 50 | public function __construct(DOMElement $element) |
| 51 | { |
| 52 | parent::__construct('The QTI class "' . $element->nodeName . '" is currently not supported.', $this->code); |
| 53 | $this->setElement($element); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Get the element which represents the unsupported QTI class. |
| 58 | * |
| 59 | * @return DOMElement |
| 60 | */ |
| 61 | public function getElement() |
| 62 | { |
| 63 | return $this->element; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Set the element which represents the unsupported QTI class. |
| 68 | * |
| 69 | * @param DOMElement $element |
| 70 | */ |
| 71 | protected function setElement(DOMElement $element) |
| 72 | { |
| 73 | $this->element = $element; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Returns a human-readable message describing the error that occurred. |
| 78 | * |
| 79 | * @return string |
| 80 | */ |
| 81 | public function getUserMessage() |
| 82 | { |
| 83 | $name = $this->getElement()->localName; |
| 84 | $line = $this->getElement()->getLineNo(); |
| 85 | return sprintf(__('The QTI class "%1$s" located at line "%2$d" is currently not supported.'), $name, $line); |
| 86 | } |
| 87 | } |