Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| UniqueNumericQtiIdentifierQtiCreator | |
0.00% |
0 / 6 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __invoke | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| isEnabled | |
0.00% |
0 / 2 |
|
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) 2024 (original work) Open Assessment Technologies SA; |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\taoQtiItem\model\FeatureFlag; |
| 24 | |
| 25 | use oat\tao\model\featureFlag\FeatureFlagCheckerInterface; |
| 26 | use oat\tao\model\featureFlag\FeatureFlagConfigHandlerInterface; |
| 27 | |
| 28 | class UniqueNumericQtiIdentifierQtiCreator implements FeatureFlagConfigHandlerInterface |
| 29 | { |
| 30 | private FeatureFlagCheckerInterface $featureFlagChecker; |
| 31 | |
| 32 | public function __construct(FeatureFlagCheckerInterface $featureFlagChecker) |
| 33 | { |
| 34 | $this->featureFlagChecker = $featureFlagChecker; |
| 35 | } |
| 36 | |
| 37 | public function __invoke(array $configs): array |
| 38 | { |
| 39 | if ($this->isEnabled()) { |
| 40 | $configs['identifierGenerationStrategy'] = 'uniqueNumeric'; |
| 41 | } |
| 42 | |
| 43 | return $configs; |
| 44 | } |
| 45 | |
| 46 | private function isEnabled(): bool |
| 47 | { |
| 48 | return $this->featureFlagChecker |
| 49 | ->isEnabled('FEATURE_FLAG_UNIQUE_NUMERIC_QTI_IDENTIFIER'); |
| 50 | } |
| 51 | } |