Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 83 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| StatisticalMetadataServiceProvider | |
0.00% |
0 / 83 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| __invoke | |
0.00% |
0 / 83 |
|
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) 2022 (original work) Open Assessment Technologies SA. |
| 19 | */ |
| 20 | |
| 21 | declare(strict_types=1); |
| 22 | |
| 23 | namespace oat\tao\model\StatisticalMetadata; |
| 24 | |
| 25 | use oat\generis\model\data\Ontology; |
| 26 | use oat\oatbox\log\LoggerService; |
| 27 | use oat\tao\model\Csv\Factory\ReaderFactory; |
| 28 | use oat\generis\model\resource\Repository\PropertyRepository; |
| 29 | use oat\tao\model\metadata\compiler\AdvancedJsonResourceMetadataCompiler; |
| 30 | use oat\tao\model\Observer\GCP\PubSubClientFactory; |
| 31 | use oat\tao\model\StatisticalMetadata\DataStore\Compiler\StatisticalJsonResourceMetadataCompiler; |
| 32 | use oat\tao\model\StatisticalMetadata\Import\Builder\ReportBuilder; |
| 33 | use oat\tao\model\StatisticalMetadata\Import\Observer\ObserverFactory; |
| 34 | use oat\tao\model\StatisticalMetadata\Import\Processor\ImportProcessor; |
| 35 | use oat\tao\model\StatisticalMetadata\Import\Processor\NotifyImportService; |
| 36 | use oat\tao\model\StatisticalMetadata\Import\Validator\HeaderValidator; |
| 37 | use oat\tao\model\StatisticalMetadata\Import\Extractor\ResourceExtractor; |
| 38 | use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface; |
| 39 | use oat\tao\model\StatisticalMetadata\Import\Extractor\MetadataValuesExtractor; |
| 40 | use oat\tao\model\StatisticalMetadata\Import\Validator\RecordResourceValidator; |
| 41 | use oat\tao\model\StatisticalMetadata\Import\Extractor\MetadataAliasesExtractor; |
| 42 | use oat\tao\model\StatisticalMetadata\Import\Extractor\MetadataHeadersExtractor; |
| 43 | use oat\tao\model\StatisticalMetadata\Import\Extractor\MetadataPropertiesExtractor; |
| 44 | use oat\tao\model\StatisticalMetadata\Import\Validator\MetadataPropertiesValidator; |
| 45 | use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; |
| 46 | use oat\tao\model\StatisticalMetadata\Import\Validator\ResourceMetadataRelationValidator; |
| 47 | |
| 48 | use function Symfony\Component\DependencyInjection\Loader\Configurator\service; |
| 49 | |
| 50 | class StatisticalMetadataServiceProvider implements ContainerServiceProviderInterface |
| 51 | { |
| 52 | public function __invoke(ContainerConfigurator $configurator): void |
| 53 | { |
| 54 | $services = $configurator->services(); |
| 55 | |
| 56 | $services->set(MetadataHeadersExtractor::class, MetadataHeadersExtractor::class); |
| 57 | |
| 58 | $services |
| 59 | ->set(MetadataAliasesExtractor::class, MetadataAliasesExtractor::class) |
| 60 | ->args( |
| 61 | [ |
| 62 | service(MetadataHeadersExtractor::class), |
| 63 | ] |
| 64 | ); |
| 65 | |
| 66 | $services |
| 67 | ->set(HeaderValidator::class, HeaderValidator::class) |
| 68 | ->args( |
| 69 | [ |
| 70 | service(MetadataHeadersExtractor::class), |
| 71 | ] |
| 72 | ); |
| 73 | |
| 74 | $services->set(MetadataPropertiesValidator::class, MetadataPropertiesValidator::class); |
| 75 | |
| 76 | $services |
| 77 | ->set(MetadataPropertiesExtractor::class, MetadataPropertiesExtractor::class) |
| 78 | ->args( |
| 79 | [ |
| 80 | service(MetadataAliasesExtractor::class), |
| 81 | service(PropertyRepository::class), |
| 82 | service(MetadataPropertiesValidator::class), |
| 83 | ] |
| 84 | ); |
| 85 | |
| 86 | $services->set(RecordResourceValidator::class, RecordResourceValidator::class); |
| 87 | |
| 88 | $services |
| 89 | ->set(ResourceExtractor::class, ResourceExtractor::class) |
| 90 | ->args( |
| 91 | [ |
| 92 | service(RecordResourceValidator::class), |
| 93 | service(Ontology::SERVICE_ID), |
| 94 | ] |
| 95 | ); |
| 96 | |
| 97 | $services->set(ResourceMetadataRelationValidator::class, ResourceMetadataRelationValidator::class); |
| 98 | |
| 99 | $services |
| 100 | ->set(MetadataValuesExtractor::class, MetadataValuesExtractor::class) |
| 101 | ->args( |
| 102 | [ |
| 103 | service(MetadataHeadersExtractor::class), |
| 104 | service(ResourceMetadataRelationValidator::class), |
| 105 | ] |
| 106 | ); |
| 107 | |
| 108 | $services->set(ReportBuilder::class, ReportBuilder::class); |
| 109 | |
| 110 | $services |
| 111 | ->set(ImportProcessor::class, ImportProcessor::class) |
| 112 | ->args( |
| 113 | [ |
| 114 | service(ReaderFactory::class), |
| 115 | service(HeaderValidator::class), |
| 116 | service(MetadataPropertiesExtractor::class), |
| 117 | service(MetadataAliasesExtractor::class), |
| 118 | service(ResourceExtractor::class), |
| 119 | service(MetadataValuesExtractor::class), |
| 120 | service(ReportBuilder::class), |
| 121 | service(NotifyImportService::class), |
| 122 | ] |
| 123 | ); |
| 124 | |
| 125 | $services |
| 126 | ->set(StatisticalJsonResourceMetadataCompiler::class, StatisticalJsonResourceMetadataCompiler::class) |
| 127 | ->args( |
| 128 | [ |
| 129 | service(AdvancedJsonResourceMetadataCompiler::class), |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $services |
| 134 | ->set(NotifyImportService::class, NotifyImportService::class) |
| 135 | ->args( |
| 136 | [ |
| 137 | service(LoggerService::SERVICE_ID), |
| 138 | service(StatisticalJsonResourceMetadataCompiler::class), |
| 139 | service(ObserverFactory::class), |
| 140 | ] |
| 141 | ); |
| 142 | |
| 143 | $services |
| 144 | ->set(ObserverFactory::class, ObserverFactory::class) |
| 145 | ->args( |
| 146 | [ |
| 147 | service(PubSubClientFactory::class), |
| 148 | service(LoggerService::SERVICE_ID), |
| 149 | ] |
| 150 | ); |
| 151 | } |
| 152 | } |