Completed
Pull Request — master (#649)
by Adrien
03:03 queued 33s
created

HelperFactory::createStringsEscaper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
 * Class HelperFactory
10
 * Factory to create helpers
11
 */
12
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
13
{
14
    /**
15
     * @param bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
16
     * @return CellValueFormatter
17
     */
18 29
    public function createCellValueFormatter($shouldFormatDates)
19
    {
20 29
        $escaper = $this->createStringsEscaper();
21
22 29
        return new CellValueFormatter($shouldFormatDates, $escaper);
23
    }
24
25
    /**
26
     * @param InternalEntityFactory $entityFactory
27
     * @return SettingsHelper
28
     */
29 31
    public function createSettingsHelper($entityFactory)
30
    {
31 31
        return new SettingsHelper($entityFactory);
32
    }
33
34
    /**
35
     * @return \Box\Spout\Common\Helper\Escaper\ODS
36
     */
37 31
    public function createStringsEscaper()
38
    {
39
        /* @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
40 31
        return new \Box\Spout\Common\Helper\Escaper\ODS();
41
    }
42
}
43