GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CompatibilityFactory::createHelperHTML()   A
last analyzed

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 Onurb\Bundle\ExcelBundle\Factory;
4
5
use Symfony\Component\HttpFoundation\StreamedResponse;
6
use PhpOffice\PhpSpreadsheet\Helper\Html;
7
use PhpOffice\PhpSpreadsheet\Reader\IReader;
8
use PhpOffice\PhpSpreadsheet\Spreadsheet;
9
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
10
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
11
12
/**
13
 * Factory for Spreadsheet objects
14
 *
15
 * Factory  inspired by the liuggio\ExcelBundle\Factory, migrated for phpoffice/phpSpreadSheet Usage
16
 * (PhpExcel used by liuggio is abandoned)
17
 *
18
 * @package Onurb\Bundle\ExcelBundle
19
 */
20
class CompatibilityFactory
21
{
22
    /**
23
     * @var ExcelFactory
24
     */
25
    private $factory;
26
27 11
    public function __construct(ExcelFactory $factory = null)
28
    {
29 11
        $this->factory = $factory ? $factory : new ExcelFactory();
30 11
    }
31
32
    /**
33
     * Creates an empty Spreadsheet Object if the filename is empty, otherwise loads the file into the object.
34
     *
35
     * @param string $filename
36
     *
37
     * @return Spreadsheet
38
     */
39 6
    public function createPHPExcelObject($filename = null)
40
    {
41 6
        return $this->factory->createSpreadsheet($filename);
42
    }
43
44
    /**
45
     * @return Drawing
46
     */
47 2
    public function createPHPExcelWorksheetDrawing()
48
    {
49 2
        return $this->factory->createSpreadsheetWorksheetDrawing();
50
    }
51
52
    /**
53
     * Create a reader
54
     *
55
     * @param string $type
56
     *
57
     * @return IReader
58
     */
59 2
    public function createReader($type = 'Xlsx')
60
    {
61 2
        return $this->factory->createReader($type);
62
    }
63
64
    /**
65
     * Create a writer given the PHPExcelObject and the type,
66
     *
67
     * @param Spreadsheet $phpExcelObject
68
     * @param string $type
69
     * @return IWriter
70
     */
71 5
    public function createWriter(Spreadsheet $phpExcelObject, $type = 'Xlsx')
72
    {
73 5
        return $this->factory->createWriter($phpExcelObject, $type);
74
    }
75
76
    /**
77
     * Stream the file as Response.
78
     *
79
     * @param IWriter $writer
80
     * @param int                      $status
81
     * @param array                    $headers
82
     *
83
     * @return StreamedResponse
84
     */
85 2
    public function createStreamedResponse(IWriter $writer, $status = 200, $headers = array())
86
    {
87 2
        return $this->factory->createStreamedResponse($writer, $status, $headers);
88
    }
89
90
    /**
91
     * Create a PHPExcel Helper HTML Object
92
     *
93
     * @return Html
94
     */
95 5
    public function createHelperHTML()
96
    {
97 5
        return $this->factory->createHelperHTML();
98
    }
99
}
100