Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| LanguageServiceProvider | 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) 2021-2022 (original work) Open Assessment Technologies SA. |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\tao\model; |
| 24 | |
| 25 | use oat\generis\model\data\Ontology; |
| 26 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
| 27 | use oat\tao\model\Language\Business\Contract\LanguageRepositoryInterface; |
| 28 | use oat\tao\model\Language\Filter\LanguageAllowedFilter; |
| 29 | use oat\tao\model\Language\Repository\LanguageRepository; |
| 30 | use oat\tao\model\Language\Listener\LanguageCacheWarmupListener; |
| 31 | use Symfony\Component\DependencyInjection\Loader\Configurator\Traits\FactoryTrait; |
| 32 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 33 | use tao_models_classes_LanguageService; |
| 34 | use oat\tao\model\Language\AscendingLabelListSorterComparator; |
| 35 | use oat\tao\model\Language\Service\LanguageListElementSortService; |
| 36 | use oat\tao\model\Language\Business\Specification\LanguageClassSpecification; |
| 37 | |
| 38 | use function Symfony\Component\DependencyInjection\Loader\Configurator\env; |
| 39 | use function Symfony\Component\DependencyInjection\Loader\Configurator\inline_service; |
| 40 | use function Symfony\Component\DependencyInjection\Loader\Configurator\param; |
| 41 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 42 | |
| 43 | /** |
| 44 | * @codeCoverageIgnore |
| 45 | */ |
| 46 | class LanguageServiceProvider implements ContainerServiceProviderInterface |
| 47 | { |
| 48 | use FactoryTrait; |
| 49 | |
| 50 | public function __invoke(ContainerConfigurator $configurator): void |
| 51 | { |
| 52 | $services = $configurator->services(); |
| 53 | $services |
| 54 | ->set(tao_models_classes_LanguageService::class, tao_models_classes_LanguageService::class) |
| 55 | ->public() |
| 56 | ->factory(tao_models_classes_LanguageService::class . '::singleton'); |
| 57 | |
| 58 | $services |
| 59 | ->set(LanguageClassSpecification::class, LanguageClassSpecification::class) |
| 60 | ->public(); |
| 61 | |
| 62 | $services |
| 63 | ->set(LanguageListElementSortService::class, LanguageListElementSortService::class) |
| 64 | ->public() |
| 65 | ->args([ |
| 66 | inline_service(AscendingLabelListSorterComparator::class), |
| 67 | ]); |
| 68 | |
| 69 | $services |
| 70 | ->set(LanguageRepositoryInterface::class, LanguageRepository::class) |
| 71 | ->public() |
| 72 | ->args( |
| 73 | [ |
| 74 | service(Ontology::SERVICE_ID), |
| 75 | service(tao_models_classes_LanguageService::class), |
| 76 | service(LanguageAllowedFilter::class) |
| 77 | ] |
| 78 | ); |
| 79 | |
| 80 | $services |
| 81 | ->set(LanguageAllowedFilter::class, LanguageAllowedFilter::class) |
| 82 | ->args( |
| 83 | [ |
| 84 | env('default::' . LanguageAllowedFilter::TAO_ALLOWED_TRANSLATION_LOCALES), |
| 85 | ] |
| 86 | ) |
| 87 | ->public(); |
| 88 | |
| 89 | $services |
| 90 | ->set(LanguageCacheWarmupListener::class, LanguageCacheWarmupListener::class) |
| 91 | ->public() |
| 92 | ->args( |
| 93 | [ |
| 94 | service(tao_models_classes_LanguageService::class), |
| 95 | ] |
| 96 | ); |
| 97 | } |
| 98 | } |