Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| PropertyRepositoryContext | |
0.00% |
0 / 10 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| getSupportedParameters | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| validateParameter | |
0.00% |
0 / 7 |
|
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) 2022 (original work) Open Assessment Technologies SA. |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\generis\model\resource\Context; |
| 24 | |
| 25 | use InvalidArgumentException; |
| 26 | use oat\generis\model\Context\AbstractContext; |
| 27 | |
| 28 | class PropertyRepositoryContext extends AbstractContext |
| 29 | { |
| 30 | public const PARAM_ALIASES = 'aliases'; |
| 31 | |
| 32 | protected function getSupportedParameters(): array |
| 33 | { |
| 34 | return [ |
| 35 | self::PARAM_ALIASES, |
| 36 | ]; |
| 37 | } |
| 38 | |
| 39 | protected function validateParameter(string $parameter, $parameterValue): void |
| 40 | { |
| 41 | if ($parameter === self::PARAM_ALIASES && !is_array($parameterValue)) { |
| 42 | throw new InvalidArgumentException( |
| 43 | sprintf( |
| 44 | 'Context parameter %s is not valid. It must be an array.', |
| 45 | $parameter |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | } |
| 50 | } |