ObjectStorageMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 46
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A canHandleType() 0 4 1
A getTcaConfiguration() 0 13 2
A getDatabaseDefinition() 0 4 1
1
<?php
2
3
/**
4
 * Map general ObjectStorage.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader\Mapper;
9
10
use HDNET\Autoloader\MapperInterface;
11
12
/**
13
 * Map general ObjectStorage.
14
 */
15
class ObjectStorageMapper implements MapperInterface
16
{
17
    /**
18
     * Check if the current mapper can handle the given type.
19
     *
20
     * @param string $type
21
     *
22
     * @return bool
23
     */
24
    public function canHandleType($type)
25
    {
26
        return false !== mb_stristr(trim($type, '\\'), 'typo3\\cms\\extbase\\persistence\\objectstorage');
27
    }
28
29
    /**
30
     * Get the TCA configuration for the current type.
31
     *
32
     * @param string $fieldName
33
     * @param bool   $overWriteLabel
34
     *
35
     * @return array
36
     */
37
    public function getTcaConfiguration($fieldName, $overWriteLabel = false)
38
    {
39
        $baseConfig = [
40
            'type' => 'user',
41
            'userFunc' => 'HDNET\\Autoloader\\UserFunctions\\Tca->objectStorageInfoField',
42
        ];
43
44
        return [
45
            'exclude' => 1,
46
            'label' => $overWriteLabel ? $overWriteLabel : $fieldName,
47
            'config' => $baseConfig,
48
        ];
49
    }
50
51
    /**
52
     * Get the database definition for the current mapper.
53
     *
54
     * @return string
55
     */
56
    public function getDatabaseDefinition()
57
    {
58
        return 'varchar(255) DEFAULT \'\' NOT NULL';
59
    }
60
}
61