getDatabaseDefinition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * Map FileReferenceObjectStorage.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader\Mapper;
9
10
use HDNET\Autoloader\MapperInterface;
11
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
12
13
/**
14
 * Map FileReferenceObjectStorage.
15
 */
16
class FileReferenceObjectStorageMapper implements MapperInterface
17
{
18
    /**
19
     * Check if the current mapper can handle the given type.
20
     *
21
     * @param string $type
22
     *
23
     * @return bool
24
     */
25
    public function canHandleType($type)
26
    {
27
        return \in_array(mb_strtolower(trim($type, '\\')), [
28
            'typo3\\cms\\extbase\\persistence\\objectstorage<\\typo3\\cms\\extbase\\domain\\model\\filereference>',
29
        ], true);
30
    }
31
32
    /**
33
     * Get the TCA configuration for the current type.
34
     *
35
     * @param string $fieldName
36
     * @param bool   $overWriteLabel
37
     *
38
     * @return array
39
     */
40
    public function getTcaConfiguration($fieldName, $overWriteLabel = false)
41
    {
42
        return [
43
            'exclude' => 1,
44
            'label' => $overWriteLabel ? $overWriteLabel : $fieldName,
45
            'config' => ExtensionManagementUtility::getFileFieldTCAConfig($fieldName),
46
        ];
47
    }
48
49
    /**
50
     * Get the database definition for the current mapper.
51
     *
52
     * @return string
53
     */
54
    public function getDatabaseDefinition()
55
    {
56
        return 'int(11) DEFAULT \'0\' NOT NULL';
57
    }
58
}
59