FluidNamespace   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A prepareLoader() 0 12 2
A loadExtensionTables() 0 3 1
A loadExtensionConfiguration() 0 6 2
1
<?php
2
3
/**
4
 * FluidNamespace.
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 TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
13
use TYPO3\CMS\Core\Utility\GeneralUtility;
14
15
/**
16
 * FluidNamespace.
17
 */
18
class FluidNamespace implements LoaderInterface
19
{
20
    /**
21
     * Get all the complex data and information for the loader.
22
     * This return value will be cached and stored in the core_cache of TYPO3.
23
     * There is no file monitoring for this cache.
24
     */
25
    public function prepareLoader(Loader $loader, int $type): array
26
    {
27
        $loaderInformation = [];
28
        $viewHelperFolder = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/ViewHelpers/';
29
        if (is_dir($viewHelperFolder)) {
30
            $extKey = $loader->getExtensionKey();
31
            $key = GeneralUtility::underscoredToLowerCamelCase($extKey);
32
            $loaderInformation[$key] = $loader->getVendorName() . '\\' . GeneralUtility::underscoredToUpperCamelCase($extKey) . '\\ViewHelpers';
33
        }
34
35
        return $loaderInformation;
36
    }
37
38
    /**
39
     * Run the loading process for the ext_tables.php file.
40
     */
41
    public function loadExtensionTables(Loader $loader, array $loaderInformation): void
42
    {
43
    }
44
45
    /**
46
     * Run the loading process for the ext_localconf.php file.
47
     */
48
    public function loadExtensionConfiguration(Loader $loader, array $loaderInformation): void
49
    {
50
        foreach ($loaderInformation as $key => $namespace) {
51
            $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces'][$key] = [$namespace];
52
        }
53
    }
54
}
55