Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| TranslationServiceProvider | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||
| __invoke | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 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\taoTests\models\Translation\ServiceProvider; |
| 24 | |
| 25 | use oat\generis\model\data\Ontology; |
| 26 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
| 27 | use oat\oatbox\event\EventManager; |
| 28 | use oat\oatbox\log\LoggerService; |
| 29 | use oat\tao\model\resources\Service\InstanceCopier; |
| 30 | use oat\tao\model\TaoOntology; |
| 31 | use oat\tao\model\featureFlag\FeatureFlagChecker; |
| 32 | use oat\tao\model\Translation\Form\Modifier\TranslationFormModifier as TaoTranslationFormModifier; |
| 33 | use oat\tao\model\Translation\Service\ResourceLanguageRetriever; |
| 34 | use oat\tao\model\Translation\Service\ResourceMetadataPopulateService; |
| 35 | use oat\tao\model\Translation\Service\TranslatedIntoLanguagesSynchronizer; |
| 36 | use oat\tao\model\Translation\Service\TranslationCreationService; |
| 37 | use oat\taoTests\models\TaoTestOntology; |
| 38 | use oat\taoTests\models\Translation\Form\Modifier\TranslationFormModifier; |
| 39 | use oat\taoTests\models\Translation\Form\Modifier\TranslationFormModifierProxy; |
| 40 | use oat\taoTests\models\Translation\Listener\TestCreatedEventListener; |
| 41 | use oat\taoTests\models\Translation\Service\TranslateIntoLanguagesHandler; |
| 42 | use oat\taoTests\models\Translation\Service\TranslationPostCreationService; |
| 43 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 44 | |
| 45 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 46 | |
| 47 | /** |
| 48 | * @codeCoverageIgnore |
| 49 | */ |
| 50 | class TranslationServiceProvider implements ContainerServiceProviderInterface |
| 51 | { |
| 52 | public function __invoke(ContainerConfigurator $configurator): void |
| 53 | { |
| 54 | $services = $configurator->services(); |
| 55 | |
| 56 | $services->get(ResourceMetadataPopulateService::class) |
| 57 | ->call( |
| 58 | 'addMetadata', |
| 59 | [ |
| 60 | TaoOntology::CLASS_URI_TEST, |
| 61 | TaoTestOntology::PROPERTY_TRANSLATION_COMPLETION, |
| 62 | ] |
| 63 | ); |
| 64 | |
| 65 | $services |
| 66 | ->set(TranslationFormModifier::class, TranslationFormModifier::class) |
| 67 | ->args([ |
| 68 | service(FeatureFlagChecker::class), |
| 69 | service(Ontology::SERVICE_ID), |
| 70 | ]); |
| 71 | |
| 72 | $services |
| 73 | ->set(TranslationFormModifierProxy::class, TranslationFormModifierProxy::class) |
| 74 | ->call( |
| 75 | 'addModifier', |
| 76 | [ |
| 77 | service(TaoTranslationFormModifier::class), |
| 78 | ] |
| 79 | ) |
| 80 | ->call( |
| 81 | 'addModifier', |
| 82 | [ |
| 83 | service(TranslationFormModifier::class), |
| 84 | ] |
| 85 | )->public(); |
| 86 | |
| 87 | $services |
| 88 | ->set(TestCreatedEventListener::class, TestCreatedEventListener::class) |
| 89 | ->public() |
| 90 | ->args([ |
| 91 | service(FeatureFlagChecker::class), |
| 92 | service(Ontology::SERVICE_ID), |
| 93 | service(ResourceLanguageRetriever::class), |
| 94 | service(LoggerService::SERVICE_ID), |
| 95 | ]); |
| 96 | |
| 97 | $services |
| 98 | ->set(TranslationPostCreationService::class, TranslationPostCreationService::class) |
| 99 | ->args( |
| 100 | [ |
| 101 | service(LoggerService::SERVICE_ID), |
| 102 | ] |
| 103 | ); |
| 104 | |
| 105 | $services |
| 106 | ->set(TranslateIntoLanguagesHandler::class, TranslateIntoLanguagesHandler::class) |
| 107 | ->args( |
| 108 | [ |
| 109 | service(LoggerService::SERVICE_ID), |
| 110 | service(EventManager::SERVICE_ID), |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $services |
| 115 | ->get(TranslationCreationService::class) |
| 116 | ->call( |
| 117 | 'setResourceTransfer', |
| 118 | [ |
| 119 | TaoOntology::CLASS_URI_TEST, |
| 120 | service(InstanceCopier::class . '::TESTS') |
| 121 | ] |
| 122 | ) |
| 123 | ->call( |
| 124 | 'addPostCreation', |
| 125 | [ |
| 126 | TaoOntology::CLASS_URI_TEST, |
| 127 | service(TranslationPostCreationService::class) |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | $services |
| 132 | ->get(TranslatedIntoLanguagesSynchronizer::class) |
| 133 | ->call( |
| 134 | 'addCallback', |
| 135 | [ |
| 136 | TaoOntology::CLASS_URI_TEST, |
| 137 | service(TranslateIntoLanguagesHandler::class) |
| 138 | ] |
| 139 | ); |
| 140 | } |
| 141 | } |