Passed
Push — tests/improvements ( 8a1e0c...81b4b0 )
by Tomas Norre
07:15
created

RequestFormFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 18
ccs 11
cts 14
cp 0.7856
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Backend\RequestForm;
6
7
/*
8
 * (c) 2020 AOE GmbH <[email protected]>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21
22
use AOE\Crawler\Value\CrawlAction;
23
use TYPO3\CMS\Core\Utility\GeneralUtility;
24
use TYPO3\CMS\Fluid\View\StandaloneView;
25
use TYPO3\CMS\Info\Controller\InfoModuleController;
26
27
final class RequestFormFactory
28
{
29 1
    public static function create(CrawlAction $selectedAction, StandaloneView $view, InfoModuleController $infoModuleController, array $extensionSettings): RequestFormInterface
30
    {
31 1
        switch ($selectedAction->__toString()) {
32 1
            case 'log':
33
                /** @var RequestFormInterface $requestForm */
34 1
                $requestForm = GeneralUtility::makeInstance(LogRequestForm::class, $view, $infoModuleController, $extensionSettings);
35 1
                break;
36 1
            case 'multiprocess':
37 1
                $requestForm = GeneralUtility::makeInstance(MultiProcessRequestForm::class, $view, $infoModuleController, $extensionSettings);
38 1
                break;
39 1
            case 'start':
40
            default:
41 1
                $requestForm = GeneralUtility::makeInstance(StartRequestForm::class, $view, $infoModuleController, $extensionSettings);
42
        }
43
44 1
        return $requestForm;
45
    }
46
}
47