ArrayMapper::getDatabaseDefinition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Map Array.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader\Mapper;
9
10
use HDNET\Autoloader\MapperInterface;
11
12
/**
13
 * Map Array.
14
 */
15
class ArrayMapper 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 \in_array(mb_strtolower($type), [
27
            'array',
28
        ], true);
29
    }
30
31
    /**
32
     * Get the TCA configuration for the current type.
33
     *
34
     * @param string $fieldName
35
     * @param bool   $overWriteLabel
36
     *
37
     * @return array
38
     */
39
    public function getTcaConfiguration($fieldName, $overWriteLabel = false)
40
    {
41
        $baseConfig = [
42
            'type' => 'user',
43
            'userFunc' => 'HDNET\\Autoloader\\UserFunctions\\Tca->arrayInfoField',
44
        ];
45
46
        return [
47
            'exclude' => 1,
48
            'label' => $overWriteLabel ? $overWriteLabel : $fieldName,
49
            'config' => $baseConfig,
50
        ];
51
    }
52
53
    /**
54
     * Get the database definition for the current mapper.
55
     *
56
     * @return string
57
     */
58
    public function getDatabaseDefinition()
59
    {
60
        return 'text';
61
    }
62
}
63