Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 39
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
QtiServiceProvider
0.00% covered (danger)
0.00%
0 / 39
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 __invoke
0.00% covered (danger)
0.00%
0 / 39
0.00% covered (danger)
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
21declare(strict_types=1);
22
23namespace oat\taoQtiItem\model\qti\ServiceProvider;
24
25use oat\generis\model\data\Ontology;
26use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface;
27use oat\oatbox\log\LoggerService;
28use oat\taoQtiItem\model\Export\Qti22PostProcessorService;
29use oat\taoBackOffice\model\lists\RemoteListService;
30use oat\taoQtiItem\model\Export\Qti3Package\ExporterFactory;
31use oat\taoQtiItem\model\Export\Qti3Package\Qti3XsdValidator;
32use oat\taoQtiItem\model\Export\Qti3Package\TransformationService;
33use oat\taoQtiItem\model\qti\converter\CaseConversionService;
34use oat\taoQtiItem\model\qti\converter\ItemConverter;
35use oat\taoQtiItem\model\qti\converter\ManifestConverter;
36use oat\taoQtiItem\model\qti\Identifier\Service\QtiIdentifierSetter;
37use oat\taoQtiItem\model\qti\Service;
38use oat\taoQtiItem\model\QtiCreator\Scales\RemoteScaleListService;
39use oat\taoQtiItem\model\ValidationService;
40use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
41
42use function Symfony\Component\DependencyInjection\Loader\Configurator\env;
43use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
44
45class QtiServiceProvider implements ContainerServiceProviderInterface
46{
47    public function __invoke(ContainerConfigurator $configurator): void
48    {
49        $services = $configurator->services();
50
51        $services
52            ->set(QtiIdentifierSetter::class, QtiIdentifierSetter::class)
53            ->args([
54                service(Service::class),
55                service(LoggerService::SERVICE_ID),
56            ]);
57
58        $services->set(Qti3XsdValidator::class, Qti3XsdValidator::class)->args([
59            service(ValidationService::class),
60        ])->public();
61
62        $services->set(TransformationService::class, TransformationService::class)->args([
63            service(Qti3XsdValidator::class),
64        ])->public();
65
66        $services->set(ExporterFactory::class, ExporterFactory::class)
67        ->args([
68            service(TransformationService::class),
69        ])->public();
70
71        $services->set(CaseConversionService::class);
72
73        $services
74            ->set(ManifestConverter::class, ManifestConverter::class)
75            ->public();
76
77        $services->set(ItemConverter::class)
78            ->args([
79                service(CaseConversionService::class),
80                service(ValidationService::SERVICE_ID)
81            ])
82            ->public();
83
84        $services->set(Qti22PostProcessorService::class)
85            ->public();
86
87        $services->set(RemoteScaleListService::class)
88            ->args([
89                service(Ontology::SERVICE_ID),
90                service(RemoteListService::class),
91                service(LoggerService::SERVICE_ID),
92                env(RemoteScaleListService::REMOTE_LIST_SCALE)
93                    ->default('')
94                    ->string()
95            ])
96            ->public();
97    }
98}