Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| InvalidSourcePathException | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getUserMessage | |
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) 2014-2018 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | namespace oat\tao\model\import; |
| 23 | |
| 24 | use common_Exception; |
| 25 | use common_exception_UserReadableException; |
| 26 | use Exception; |
| 27 | |
| 28 | class InvalidSourcePathException extends common_Exception implements common_exception_UserReadableException |
| 29 | { |
| 30 | /** |
| 31 | * @var string |
| 32 | */ |
| 33 | private $sourcePath; |
| 34 | |
| 35 | /** |
| 36 | * @param string $basePath |
| 37 | * @param string $sourcePath |
| 38 | * @param Exception|null $previous |
| 39 | */ |
| 40 | public function __construct($basePath, $sourcePath, Exception $previous = null) |
| 41 | { |
| 42 | $this->sourcePath = $sourcePath; |
| 43 | |
| 44 | $message = sprintf('The path to the source file "%s" is outside the base path "%s"', $sourcePath, $basePath); |
| 45 | |
| 46 | parent::__construct($message, 0, $previous); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Get the human-readable message for the end-user. It is supposed |
| 51 | * to be translated and does not contain any confidential information |
| 52 | * about the system and its sensitive data. |
| 53 | * |
| 54 | * @return string A human-readable message. |
| 55 | */ |
| 56 | public function getUserMessage() |
| 57 | { |
| 58 | // phpcs:disable Generic.Files.LineLength |
| 59 | return __('Invalid path of a source "%s". Path must point to the existed file inside the package.', $this->sourcePath); |
| 60 | // phpcs:enable Generic.Files.LineLength |
| 61 | } |
| 62 | } |