Completed
Pull Request — master (#773)
by
unknown
12:09
created

HelperFactory::createCellFormulaFormatter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
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\XLSX\Creator;
4
5
use Box\Spout\Common\Helper\Escaper;
6
use Box\Spout\Reader\XLSX\Helper\CellValueFormatter;
7
use Box\Spout\Reader\XLSX\Helper\CellFormulaFormatter;
8
use Box\Spout\Reader\XLSX\Manager\SharedStringsManager;
9
use Box\Spout\Reader\XLSX\Manager\StyleManager;
10
11
/**
12
 * Class HelperFactory
13
 * Factory to create helpers
14
 */
15
class HelperFactory extends \Box\Spout\Common\Creator\HelperFactory
16
{
17
    /**
18
     * @param SharedStringsManager $sharedStringsManager Manages shared strings
19
     * @param StyleManager $styleManager Manages styles
20
     * @param bool $shouldFormatDates Whether date/time values should be returned as PHP objects or be formatted as strings
21
     * @param bool $shouldUse1904Dates Whether date/time values should use a calendar starting in 1904 instead of 1900
22
     * @return CellValueFormatter
23 39
     */
24
    public function createCellValueFormatter($sharedStringsManager, $styleManager, $shouldFormatDates, $shouldUse1904Dates)
25 39
    {
26
        $escaper = $this->createStringsEscaper();
27 39
28
        return new CellValueFormatter($sharedStringsManager, $styleManager, $shouldFormatDates, $shouldUse1904Dates, $escaper);
29
    }
30
    /**
31
     * @return CellFormulaFormatter
32
     */
33 40
    public function createCellFormulaFormatter()
34
    {
35
        return new CellFormulaFormatter();
36 40
    }
37
38
    /**
39
     * @return Escaper\XLSX
40
     */
41
    public function createStringsEscaper()
42
    {
43
        /* @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
44
        return new Escaper\XLSX();
45
    }
46
}
47