Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
CopierServiceProvider | 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) 2022 (original work) Open Assessment Technologies SA. |
19 | * |
20 | * @author Andrei Shapiro <andrei.shapiro@taotesting.com> |
21 | */ |
22 | |
23 | declare(strict_types=1); |
24 | |
25 | namespace oat\tao\model\resources; |
26 | |
27 | use oat\generis\model\data\Ontology; |
28 | use oat\oatbox\event\EventManager; |
29 | use oat\oatbox\filesystem\FileSystemService; |
30 | use oat\tao\model\resources\Service\ClassMover; |
31 | use oat\tao\model\resources\Service\InstanceCopier; |
32 | use oat\tao\model\resources\Service\ClassCopierProxy; |
33 | use oat\tao\model\resources\Service\ClassMetadataMapper; |
34 | use oat\tao\model\resources\Service\ClassMetadataCopier; |
35 | use oat\tao\model\resources\Service\InstanceCopierProxy; |
36 | use oat\tao\model\resources\Service\InstanceMetadataCopier; |
37 | use oat\tao\model\resources\Service\InstanceMover; |
38 | use oat\tao\model\resources\Service\ResourceTransferProxy; |
39 | use oat\tao\model\resources\Service\RootClassesListService; |
40 | use oat\generis\model\fileReference\FileReferenceSerializer; |
41 | use oat\tao\model\resources\Specification\RootClassSpecification; |
42 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
43 | use oat\tao\model\TaoOntology; |
44 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
45 | |
46 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
47 | use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; |
48 | |
49 | /** |
50 | * @codeCoverageIgnore |
51 | */ |
52 | class CopierServiceProvider implements ContainerServiceProviderInterface |
53 | { |
54 | public function __invoke(ContainerConfigurator $configurator): void |
55 | { |
56 | $services = $configurator->services(); |
57 | |
58 | $services->set(ClassMetadataMapper::class, ClassMetadataMapper::class); |
59 | |
60 | $services |
61 | ->set(ClassMetadataCopier::class, ClassMetadataCopier::class) |
62 | ->share(false) |
63 | ->args( |
64 | [ |
65 | service(ClassMetadataMapper::class), |
66 | ] |
67 | ); |
68 | |
69 | $services |
70 | ->set(InstanceMetadataCopier::class, InstanceMetadataCopier::class) |
71 | ->share(false) |
72 | ->args( |
73 | [ |
74 | service(ClassMetadataMapper::class), |
75 | service(FileReferenceSerializer::SERVICE_ID), |
76 | service(FileSystemService::SERVICE_ID), |
77 | [ |
78 | TaoOntology::PROPERTY_LANGUAGE, |
79 | TaoOntology::PROPERTY_TRANSLATION_STATUS, |
80 | TaoOntology::PROPERTY_TRANSLATION_TYPE |
81 | ] |
82 | ] |
83 | ); |
84 | |
85 | $services |
86 | ->get(InstanceMetadataCopier::class) |
87 | ->call( |
88 | 'addPropertyUrisToBlacklist', |
89 | [ |
90 | [ |
91 | TaoOntology::PROPERTY_UNIQUE_IDENTIFIER, |
92 | ] |
93 | ] |
94 | ); |
95 | |
96 | $services |
97 | ->set(InstanceCopier::class, InstanceCopier::class) |
98 | ->args( |
99 | [ |
100 | service(InstanceMetadataCopier::class), |
101 | service(Ontology::SERVICE_ID) |
102 | ] |
103 | ); |
104 | |
105 | $services |
106 | ->set(ClassCopierProxy::class, ClassCopierProxy::class) |
107 | ->share(false) |
108 | ->public() |
109 | ->args( |
110 | [ |
111 | service(RootClassesListService::class), |
112 | service(Ontology::SERVICE_ID), |
113 | ] |
114 | ); |
115 | |
116 | $services |
117 | ->set(InstanceCopierProxy::class, InstanceCopierProxy::class) |
118 | ->share(false) |
119 | ->public() |
120 | ->args( |
121 | [ |
122 | service(RootClassesListService::class), |
123 | service(Ontology::SERVICE_ID), |
124 | ] |
125 | ); |
126 | |
127 | $services |
128 | ->set(ClassMover::class, ClassMover::class) |
129 | ->share(false) |
130 | ->args( |
131 | [ |
132 | service(Ontology::SERVICE_ID), |
133 | service(RootClassSpecification::class), |
134 | service(RootClassesListService::class), |
135 | service(EventManager::SERVICE_ID) |
136 | ] |
137 | ) |
138 | ->call( |
139 | 'withPermissionCopiers', |
140 | [ |
141 | tagged_iterator('tao.copier.permissions'), |
142 | ] |
143 | ); |
144 | |
145 | $services |
146 | ->set(InstanceMover::class, InstanceMover::class) |
147 | ->args( |
148 | [ |
149 | service(Ontology::SERVICE_ID), |
150 | service(RootClassesListService::class), |
151 | ] |
152 | ) |
153 | ->call( |
154 | 'withPermissionCopiers', |
155 | [ |
156 | tagged_iterator('tao.copier.permissions'), |
157 | ] |
158 | ); |
159 | |
160 | $services |
161 | ->set(ResourceTransferProxy::class, ResourceTransferProxy::class) |
162 | ->share(false) |
163 | ->public() |
164 | ->args( |
165 | [ |
166 | service(ClassCopierProxy::class), |
167 | service(InstanceCopierProxy::class), |
168 | service(ClassMover::class), |
169 | service(InstanceMover::class), |
170 | service(Ontology::SERVICE_ID), |
171 | ] |
172 | ); |
173 | } |
174 | } |