Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
42.86% |
3 / 7 |
|
50.00% |
2 / 4 |
CRAP | |
0.00% |
0 / 1 |
| common_ext_ExtensionException | |
42.86% |
3 / 7 |
|
50.00% |
2 / 4 |
6.99 | |
0.00% |
0 / 1 |
| setExtensionId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getExtensionId | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getSeverity | |
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) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung |
| 19 | * (under the project TAO-TRANSFER); |
| 20 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 21 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * Any exception related to extensions should inherit this class. |
| 29 | * |
| 30 | * @access public |
| 31 | * @author lionel.lecaque@tudor.lu |
| 32 | * @package generis |
| 33 | * @see @license GNU General Public (GPL) Version 2 http://www.opensource.org/licenses/gpl-2.0.php |
| 34 | |
| 35 | */ |
| 36 | class common_ext_ExtensionException extends common_Exception implements common_log_SeverityLevel |
| 37 | { |
| 38 | // --- ASSOCIATIONS --- |
| 39 | |
| 40 | |
| 41 | // --- ATTRIBUTES --- |
| 42 | |
| 43 | /** |
| 44 | * The extension ID related to the exception. |
| 45 | * |
| 46 | * @access private |
| 47 | * @var Integer |
| 48 | */ |
| 49 | private $extensionId = null; |
| 50 | |
| 51 | // --- OPERATIONS --- |
| 52 | |
| 53 | /** |
| 54 | * Sets the extension ID related to the exception. |
| 55 | * |
| 56 | * @access public |
| 57 | * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu> |
| 58 | * @param string extensionId An extension ID. |
| 59 | * @return mixed |
| 60 | */ |
| 61 | public function setExtensionId($extensionId) |
| 62 | { |
| 63 | |
| 64 | $this->extensionId = $extensionId; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Get the extension ID related to the exception |
| 69 | * |
| 70 | * @access public |
| 71 | * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu> |
| 72 | * @return string |
| 73 | */ |
| 74 | public function getExtensionId() |
| 75 | { |
| 76 | $returnValue = (string) ''; |
| 77 | |
| 78 | |
| 79 | $returnValue = $this->extensionId; |
| 80 | |
| 81 | |
| 82 | return (string) $returnValue; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Creates a new instance of ExtensionException. |
| 87 | * |
| 88 | * @access public |
| 89 | * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu> |
| 90 | * @param string message |
| 91 | * @param string extensionId |
| 92 | * @return mixed |
| 93 | */ |
| 94 | public function __construct($message, $extensionId = 'unknown') |
| 95 | { |
| 96 | |
| 97 | parent::__construct($message); |
| 98 | $this->setExtensionId($extensionId); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Get the severity of the error. |
| 103 | * |
| 104 | * @access public |
| 105 | * @return int |
| 106 | */ |
| 107 | public function getSeverity() |
| 108 | { |
| 109 | return common_Logger::ERROR_LEVEL; |
| 110 | } |
| 111 | } |