ExtensionId::loadExtensionConfiguration()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
/**
4
 * Loading eID.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader\Loader;
9
10
use HDNET\Autoloader\Loader;
11
use HDNET\Autoloader\LoaderInterface;
12
use HDNET\Autoloader\Utility\FileUtility;
13
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
14
15
/**
16
 * Loading eID.
17
 */
18
class ExtensionId implements LoaderInterface
19
{
20
    /**
21
     * Get all the complex data for the loader.
22
     * This return value will be cached and stored in the database
23
     * There is no file monitoring for this cache.
24
     */
25
    public function prepareLoader(Loader $loader, int $type): array
26
    {
27
        $scripts = [];
28
        $folder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/Php/eID/';
29
        $files = FileUtility::getBaseFilesInDir($folder, 'php');
30
31
        foreach ($files as $eIdFile) {
32
            $scripts[] = [
33
                'name' => $eIdFile,
34
                'path' => 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Php/eID/' . $eIdFile . '.php',
35
            ];
36
        }
37
38
        return $scripts;
39
    }
40
41
    /**
42
     * Run the loading process for the ext_tables.php file.
43
     */
44
    public function loadExtensionTables(Loader $loader, array $loaderInformation): void
45
    {
46
    }
47
48
    /**
49
     * Run the loading process for the ext_localconf.php file.
50
     *
51
     * @internal param \HDNET\Autoloader\Loader $autoLoader
52
     */
53
    public function loadExtensionConfiguration(Loader $loader, array $loaderInformation): void
54
    {
55
        foreach ($loaderInformation as $elements) {
56
            $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include'][$elements['name']] = $elements['path'];
57
        }
58
    }
59
}
60