ExcelGenericDateItemConverter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 17
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 14 4
1
<?php
2
3
namespace Mathielen\DataImport\ValueConverter;
4
5
class ExcelGenericDateItemConverter extends GenericDateItemConverter
6
{
7 2
    public function convert($input)
8
    {
9 2
        if (!$input) {
10 1
            return;
11
        }
12
13 1
        if (is_numeric($input) && $input < 100000) { //Date may be 42338 (=> 30.11.2015
14 1
            $date = \PHPExcel_Shared_Date::ExcelToPHPObject($input);
15
16 1
            return $this->formatOutput($date);
17
        }
18
19
        return parent::convert($input);
20
    }
21
}
22