FloatMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
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 48
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A canHandleType() 0 7 1
A getTcaConfiguration() 0 12 2
A getDatabaseDefinition() 0 4 1
1
<?php
2
3
/**
4
 * Map float/double.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader\Mapper;
9
10
use HDNET\Autoloader\MapperInterface;
11
12
/**
13
 * Map float/double.
14
 */
15
class FloatMapper 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
            'float',
28
            'double',
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' => [
46
                'type' => 'input',
47
                'eval' => 'double2',
48
                'size' => 8,
49
            ],
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 'varchar(255) DEFAULT \'\' NOT NULL';
61
    }
62
}
63