Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 48 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
ListServiceProvider | |
0.00% |
0 / 48 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
__invoke | |
0.00% |
0 / 48 |
|
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) 2021 (original work) Open Assessment Technologies SA; |
19 | */ |
20 | |
21 | declare(strict_types=1); |
22 | |
23 | namespace oat\taoBackOffice\model\lists; |
24 | |
25 | use oat\tao\model\featureFlag\FeatureFlagChecker; |
26 | use oat\tao\model\Lists\Business\Service\RemoteSource; |
27 | use oat\tao\model\Lists\Business\Service\ValueCollectionService; |
28 | use oat\taoBackOffice\model\lists\Service\ListDeleter; |
29 | use oat\generis\model\resource\Repository\ClassRepository; |
30 | use oat\taoBackOffice\model\ListElement\Service\ListElementsDeleter; |
31 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
32 | use oat\tao\model\Lists\Business\Specification\RemoteListClassSpecification; |
33 | use oat\tao\model\Lists\DataAccess\Repository\ParentPropertyListCachedRepository; |
34 | use oat\taoBackOffice\model\lists\Service\ListUpdater; |
35 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
36 | |
37 | use function Symfony\Component\DependencyInjection\Loader\Configurator\env; |
38 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
39 | |
40 | class ListServiceProvider implements ContainerServiceProviderInterface |
41 | { |
42 | public function __invoke(ContainerConfigurator $configurator): void |
43 | { |
44 | $services = $configurator->services(); |
45 | $parameters = $configurator->parameters(); |
46 | |
47 | $parameters->set('LOCAL_LIST_MAX_ITEMS', 1000); |
48 | |
49 | $services |
50 | ->set(ListService::class, ListService::class) |
51 | ->public() |
52 | ->factory(ListService::class . '::singleton') |
53 | ->call('setMaxItems', [ |
54 | env('LOCAL_LIST_MAX_ITEMS') |
55 | ->default('LOCAL_LIST_MAX_ITEMS') |
56 | ->int() |
57 | ]); |
58 | |
59 | $services |
60 | ->set(ListCreator::class, ListCreator::class) |
61 | ->public() |
62 | ->args( |
63 | [ |
64 | service(ListService::class), |
65 | service(RemoteListClassSpecification::class), |
66 | ] |
67 | ); |
68 | |
69 | $services |
70 | ->set(ListDeleter::class, ListDeleter::class) |
71 | ->public() |
72 | ->args( |
73 | [ |
74 | service(ListElementsDeleter::class), |
75 | service(RemoteListClassSpecification::class), |
76 | service(ParentPropertyListCachedRepository::class), |
77 | service(ClassRepository::class), |
78 | ] |
79 | ); |
80 | |
81 | $services |
82 | ->set(ListUpdater::class, ListUpdater::class) |
83 | ->public() |
84 | ->args( |
85 | [ |
86 | service(ValueCollectionService::class), |
87 | service(ListService::class), |
88 | ] |
89 | ); |
90 | |
91 | $services->set(RemoteListService::class) |
92 | ->args([ |
93 | service(ValueCollectionService::class), |
94 | service(RemoteSource::SERVICE_ID), |
95 | service(FeatureFlagChecker::class), |
96 | ]) |
97 | ->public(); |
98 | } |
99 | } |