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.

WrongParameterController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 6
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A wrongTypeWriterAction() 0 7 1
A wrongTypeReaderAction() 0 5 1
A createSpreadsheet() 0 25 1
1
<?php
2
3
namespace  Onurb\Bundle\ExcelBundle\Controller;
4
5
use Onurb\Bundle\ExcelBundle\Factory\ExcelFactory;
6
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7
use Symfony\Component\HttpFoundation\Response;
8
use PhpOffice\PhpSpreadsheet\Reader\IReader;
9
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
10
11
class WrongParameterController extends Controller
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
12
{
13
    public function wrongTypeWriterAction()
14
    {
15
        // create an empty object
16
        $phpSpreadsheet = $this->createSpreadsheet();
17
        // create the writer
18
        $this->get('phpspreadsheet')->createWriter($phpSpreadsheet, 'Wrong type');
19
    }
20
21
    public function wrongTypeReaderAction()
22
    {
23
        // create the writer
24
        $this->get('phpspreadsheet')->createReader('Wrong type');
25
    }
26
27
    /**
28
     * utility class
29
     * @return mixed
30
     */
31
    private function createSpreadsheet()
32
    {
33
        /** @var ExcelFactory $factory */
34
        $factory = $this->get('phpspreadsheet');
35
        $spreadsheet = $factory->createSpreadsheet();
36
37
        $htmlHelper = $factory->createHelperHTML();
38
39
        $spreadsheet->getProperties()->setCreator("liuggio")
40
            ->setLastModifiedBy("Giulio De Donato")
41
            ->setTitle("Office 2005 XLSX Test Document")
42
            ->setSubject("Office 2005 XLSX Test Document")
43
            ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")
44
            ->setKeywords("office 2005 openxml php")
45
            ->setCategory("Test result file");
46
        $spreadsheet->setActiveSheetIndex(0)
47
            ->setCellValue('A1', 'Hello')
48
            ->setCellValue('B2', 'world!')
49
            ->setCellValue('C3', $htmlHelper->toRichTextObject('<b>In Bold!</b>'));
50
        $spreadsheet->getActiveSheet()->setTitle('Simple');
51
        // Set active sheet index to the first sheet, so Excel opens this as the first sheet
52
        $spreadsheet->setActiveSheetIndex(0);
53
54
        return $spreadsheet;
55
    }
56
}
57