BackendUtility   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A registerStartIcon() 0 8 1
A registerCrawlerIcon() 0 8 1
A registerIcons() 0 5 1
A registerStopIcon() 0 8 1
A registerInfoModuleFunction() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Utility;
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\Backend\BackendModule;
23
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
24
use TYPO3\CMS\Core\Imaging\IconRegistry;
25
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
26
use TYPO3\CMS\Core\Utility\GeneralUtility;
27
28
/**
29
 * @codeCoverageIgnore
30
 * @internal since v9.2.5
31
 */
32
class BackendUtility
33
{
34
    /**
35
     * Registers the crawler info module function
36
     */
37
    public static function registerInfoModuleFunction(): void
38
    {
39
        ExtensionManagementUtility::insertModuleFunction(
40
            'web_info',
41
            BackendModule::class,
42
            null,
43
            'LLL:EXT:crawler/Resources/Private/Language/Backend.xlf:moduleFunction.tx_crawler_modfunc1'
44
        );
45
    }
46
47
    /**
48
     * Registers icons for use in the IconFactory
49
     */
50
    public static function registerIcons(): void
51
    {
52
        self::registerCrawlerIcon();
53
        self::registerStartIcon();
54
        self::registerStopIcon();
55
    }
56
57
    /**
58
     * Register Start Icon
59
     */
60
    private static function registerStartIcon(): void
61
    {
62
        /** @var IconRegistry $iconRegistry */
63
        $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
64
        $iconRegistry->registerIcon(
65
            'tx-crawler-start',
66
            SvgIconProvider::class,
67
            ['source' => 'EXT:crawler/Resources/Public/Icons/crawler_start.svg']
68
        );
69
    }
70
71
    /**
72
     * Register Stop Icon
73
     */
74
    private static function registerStopIcon(): void
75
    {
76
        /** @var IconRegistry $iconRegistry */
77
        $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
78
        $iconRegistry->registerIcon(
79
            'tx-crawler-stop',
80
            SvgIconProvider::class,
81
            ['source' => 'EXT:crawler/Resources/Public/Icons/crawler_stop.svg']
82
        );
83
    }
84
85
    private static function registerCrawlerIcon(): void
86
    {
87
        /** @var IconRegistry $iconRegistry */
88
        $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
89
        $iconRegistry->registerIcon(
90
            'tx-crawler',
91
            SvgIconProvider::class,
92
            ['source' => 'EXT:crawler/Resources/Public/Icons/crawler_configuration.svg']
93
        );
94
    }
95
}
96