Completed
Push — master ( 674c45...3a5716 )
by John
02:35
created

DateFormatterFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 23
rs 10
c 0
b 0
f 0
ccs 13
cts 13
cp 1
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFormatter() 0 17 3
1
<?php
2
3
namespace Graze\CiffRenderer\DateFormatter;
4
5
use Graze\CiffRenderer\DateFormatter\DateFormat;
6
use Graze\CiffRenderer\DateFormatter\DateFormatterBasic;
7
use Graze\CiffRenderer\DateFormatter\DateFormatterDayOfYear;
8
use Graze\CiffRenderer\DateFormatter\DateFormatterDayOfYearFixedLength;
9
10
class DateFormatterFactory
11
{
12
    /**
13
     * @param string $dateFormat
14
     * @return \DateFormatterInterface
0 ignored issues
show
Bug introduced by
The type DateFormatterInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
     */
16 3
    public function getFormatter($dateFormat)
17
    {
18 3
        switch (strtolower($dateFormat)) {
19 3
            case DateFormat::DATE_FORMAT_DAY_OF_YEAR:
20 1
                $class = DateFormatterDayOfYear::class;
21 1
                break;
22
23 2
            case DateFormat::DATE_FORMAT_DAY_OF_YEAR_FIXED_LENGTH:
24 1
                $class = DateFormatterDayOfYearFixedLength::class;
25 1
                break;
26
27 1
            default:
28 1
                $class = DateFormatterBasic::class;
29 1
                break;
30 3
        }
31
32 3
        return $class::factory();
33
    }
34
}
35