Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
tao_actions_MetadataImport
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 6
42
0.00% covered (danger)
0.00%
0 / 1
 getFormTitle
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAvailableImportHandlers
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
 getImportHandlerServiceIdMap
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getImportByHandler
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCurrentClass
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAgnosticImportHandler
0.00% covered (danger)
0.00%
0 / 1
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) 2021-2022 (original work) Open Assessment Technologies SA.
19 */
20
21declare(strict_types=1);
22
23use oat\tao\model\TaoOntology;
24use oat\tao\model\import\Form\MetadataImportForm;
25use oat\tao\model\import\service\AgnosticImportHandler;
26use oat\tao\model\task\ImportByHandler;
27use oat\tao\model\task\UnrelatedResourceImportByHandler;
28
29class tao_actions_MetadataImport extends tao_actions_Import
30{
31    protected function getFormTitle(): string
32    {
33        return __('Import statistical analysis metadata');
34    }
35
36    protected function getAvailableImportHandlers(): array
37    {
38        return [
39            $this->getAgnosticImportHandler()
40                ->withForm(
41                    (new MetadataImportForm())
42                        ->withRequestData($this->getPostParameters())
43                        ->getForm()
44                )
45        ];
46    }
47
48    protected function getImportHandlerServiceIdMap(): array
49    {
50        return [
51            AgnosticImportHandler::class => AgnosticImportHandler::STATISTICAL_METADATA_SERVICE_ID,
52        ];
53    }
54
55    protected function getImportByHandler(): ImportByHandler
56    {
57        return new UnrelatedResourceImportByHandler();
58    }
59
60    protected function getCurrentClass(): core_kernel_classes_Class
61    {
62        return $this->getClass(TaoOntology::CLASS_URI_ITEM);
63    }
64
65    private function getAgnosticImportHandler(): AgnosticImportHandler
66    {
67        return $this->getPsrContainer()->get(AgnosticImportHandler::STATISTICAL_METADATA_SERVICE_ID);
68    }
69}