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\taoItems\model\Copier; |
26 | |
27 | use oat\generis\model\data\Ontology; |
28 | use oat\tao\model\resources\Service\InstanceCopierProxy; |
29 | use oat\tao\model\TaoOntology; |
30 | use oat\oatbox\event\EventManager; |
31 | use oat\taoItems\model\TaoItemOntology; |
32 | use taoItems_models_classes_ItemsService; |
33 | use oat\tao\model\resources\Service\ClassCopier; |
34 | use oat\tao\model\resources\Service\InstanceCopier; |
35 | use oat\tao\model\resources\Service\ClassCopierProxy; |
36 | use oat\tao\model\resources\Service\ClassMetadataCopier; |
37 | use oat\tao\model\resources\Service\ClassMetadataMapper; |
38 | use oat\tao\model\resources\Service\InstanceMetadataCopier; |
39 | use oat\tao\model\resources\Service\RootClassesListService; |
40 | use oat\generis\model\fileReference\FileReferenceSerializer; |
41 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
42 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
43 | |
44 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
45 | use function Symfony\Component\DependencyInjection\Loader\Configurator\tagged_iterator; |
46 | |
47 | /** |
48 | * @codeCoverageIgnore |
49 | */ |
50 | class CopierServiceProvider implements ContainerServiceProviderInterface |
51 | { |
52 | public function __invoke(ContainerConfigurator $configurator): void |
53 | { |
54 | $services = $configurator->services(); |
55 | |
56 | $services |
57 | ->set(taoItems_models_classes_ItemsService::class, taoItems_models_classes_ItemsService::class) |
58 | ->factory(taoItems_models_classes_ItemsService::class . '::singleton'); |
59 | |
60 | $services |
61 | ->get(InstanceMetadataCopier::class) |
62 | ->call( |
63 | 'addPropertyUriToBlacklist', |
64 | [ |
65 | TaoItemOntology::PROPERTY_ITEM_CONTENT |
66 | ] |
67 | ); |
68 | |
69 | $services |
70 | ->set(ItemContentCopier::class, ItemContentCopier::class) |
71 | ->args( |
72 | [ |
73 | service(FileReferenceSerializer::SERVICE_ID), |
74 | service(taoItems_models_classes_ItemsService::class), |
75 | service(EventManager::SERVICE_ID), |
76 | ] |
77 | ); |
78 | |
79 | $services |
80 | ->set(InstanceCopier::class . '::ITEMS', InstanceCopier::class) |
81 | ->args( |
82 | [ |
83 | service(InstanceMetadataCopier::class), |
84 | service(Ontology::SERVICE_ID) |
85 | ] |
86 | ) |
87 | ->call( |
88 | 'withInstanceContentCopier', |
89 | [ |
90 | service(ItemContentCopier::class), |
91 | ] |
92 | ) |
93 | ->call( |
94 | 'withPermissionCopiers', |
95 | [ |
96 | tagged_iterator('tao.copier.permissions'), |
97 | ] |
98 | ) |
99 | ->call( |
100 | 'withEventManager', |
101 | [ |
102 | service(EventManager::class), |
103 | ] |
104 | ); |
105 | |
106 | $services |
107 | ->set(ClassCopier::class . '::ITEMS', ClassCopier::class) |
108 | ->share(false) |
109 | ->args( |
110 | [ |
111 | service(RootClassesListService::class), |
112 | service(ClassMetadataCopier::class), |
113 | service(InstanceCopier::class . '::ITEMS'), |
114 | service(ClassMetadataMapper::class), |
115 | service(Ontology::SERVICE_ID), |
116 | ] |
117 | ) |
118 | ->call( |
119 | 'withPermissionCopiers', |
120 | [ |
121 | tagged_iterator('tao.copier.permissions'), |
122 | ] |
123 | ); |
124 | |
125 | $services |
126 | ->set(ItemClassCopier::class, ItemClassCopier::class) |
127 | ->share(false) |
128 | ->args( |
129 | [ |
130 | service(ClassCopier::class . '::ITEMS'), |
131 | service(Ontology::SERVICE_ID), |
132 | ] |
133 | ); |
134 | |
135 | $services |
136 | ->get(ClassCopierProxy::class) |
137 | ->call( |
138 | 'addClassCopier', |
139 | [ |
140 | TaoOntology::CLASS_URI_ITEM, |
141 | service(ItemClassCopier::class), |
142 | ] |
143 | ); |
144 | |
145 | $services |
146 | ->get(InstanceCopierProxy::class) |
147 | ->call( |
148 | 'addInstanceCopier', |
149 | [ |
150 | TaoOntology::CLASS_URI_ITEM, |
151 | service(InstanceCopier::class . '::ITEMS'), |
152 | ] |
153 | ); |
154 | } |
155 | } |