Completed
Pull Request — develop_3.0 (#457)
by Adrien
02:34
created

HelperFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 29
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createCellValueFormatter() 0 5 1
A createSettingsHelper() 0 4 1
A createStringsEscaper() 0 5 1
1
<?php
2
3
namespace Box\Spout\Reader\ODS\Creator;
4
5
use Box\Spout\Reader\ODS\Helper\CellValueFormatter;
6
use Box\Spout\Reader\ODS\Helper\SettingsHelper;
7
8
9
/**
10
 * Class EntityFactory
11
 * Factory to create helpers
12
 *
13
 * @package Box\Spout\Reader\ODS\Creator
14
 */
15
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
16
{
17
    /**
18
     * @param bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
19
     * @return CellValueFormatter
20
     */
21 28
    public function createCellValueFormatter($shouldFormatDates)
22
    {
23 28
        $escaper = $this->createStringsEscaper();
24 28
        return new CellValueFormatter($shouldFormatDates, $escaper);
25
    }
26
27
    /**
28
     * @return SettingsHelper
29
     */
30 30
    public function createSettingsHelper()
31
    {
32 30
        return new SettingsHelper();
33
    }
34
35
    /**
36
     * @return \Box\Spout\Common\Helper\Escaper\ODS
37
     */
38 30
    public function createStringsEscaper()
39
    {
40
        /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
41 30
        return new \Box\Spout\Common\Helper\Escaper\ODS();
42
    }
43
}
44