Passed
Push — 4.1 ( e69caa...2aa683 )
by Andrea
13:33
created

TabellaXls::printBodyXls()   B

Complexity

Conditions 8
Paths 15

Size

Total Lines 28
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 8

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 28
ccs 21
cts 21
cp 1
rs 8.4444
c 0
b 0
f 0
cc 8
nc 15
nop 3
crap 8
1
<?php
2
3
namespace Fi\CoreBundle\Utils\Export;
4
5
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6
use PhpOffice\PhpSpreadsheet\Writer\Xls;
7
use PhpOffice\PhpSpreadsheet\Style\Fill;
8
use PhpOffice\PhpSpreadsheet\Style\Border;
9
use Fi\CoreBundle\Utils\Entity\DoctrineFieldReader;
10
11
class TabellaXls
12
{
13 2
    public function esportaexcel($parametri = array())
14
    {
15 2
        set_time_limit(960);
16 2
        ini_set('memory_limit', '2048M');
17
18
        //Creare un nuovo file
19 2
        $spreadsheet = new Spreadsheet();
20 2
        $objPHPExcel = new Xls($spreadsheet);
21 2
        $spreadsheet->setActiveSheetIndex(0);
22
23
        // Set properties
24 2
        $spreadsheet->getProperties()->setCreator('Comune di Firenze');
25 2
        $spreadsheet->getProperties()->setLastModifiedBy('Comune di Firenze');
26
27
28 2
        $header = $parametri['parametritabella'];
29 2
        $rows = $parametri['recordstabella'];
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
30
        //Scrittura su file
31 2
        $sheet = $spreadsheet->getActiveSheet();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
32 2
        $titolosheet = 'Esportazione ' . $parametri['nomecontroller'];
33 2
        $sheet->setTitle(substr($titolosheet, 0, 30));
34 2
        $sheet->getParent()->getDefaultStyle()->getFont()->setName('Verdana');
35
36 2
        $this->printHeaderXls($header, $sheet);
37
38 2
        $this->printBodyXls($header, $rows, $sheet);
39
40
        //Si crea un oggetto
41 2
        $todaydate = date('d-m-y');
42
43 2
        $filename = 'Exportazione';
44 2
        $filename = $filename . '-' . $todaydate . '-' . strtoupper(md5(uniqid(rand(), true)));
45 2
        $filename = $filename . '.xls';
46 2
        $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $filename;
47
48 2
        if (file_exists($filename)) {
49
            unlink($filename);
50
        }
51
52 2
        $objPHPExcel->save($filename);
53
54 2
        return $filename;
55
    }
56 2
    private function printHeaderXls($testata, $sheet)
57
    {
58 2
        $indicecolonnaheader = 1;
59 2
        $letteracolonna = 0;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
60 2
        foreach ($testata as $modellocolonna) {
61 2
            if ($modellocolonna["escluso"] === false) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal escluso does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
62
                //Si imposta la larghezza delle colonne
63 2
                $letteracolonna = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($indicecolonnaheader);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
64 2
                $width = (int) $modellocolonna['larghezza'] / 7;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 20 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
65 2
                $indicecolonnaheadertitle = $modellocolonna['etichetta'];
66 2
                $coltitle = strtoupper($indicecolonnaheadertitle);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
67 2
                $sheet->setCellValueByColumnAndRow($indicecolonnaheader, 1, $coltitle);
68 2
                $sheet->getColumnDimension($letteracolonna)->setWidth($width);
69
70 2
                ++$indicecolonnaheader;
71
            }
72
        }
73
74 2
        if ($indicecolonnaheader > 0) {
75
            //Si imposta il colore dello sfondo delle celle
76
            //Colore header
77
            $style_header = array(
78 2
                'fill' => array(
79 2
                    'type' => Fill::FILL_SOLID,
80
                    'color' => array('rgb' => 'E5E4E2')
81
                ),
82
                'font' => array(
83
                    'bold' => true
84
                )
85
            );
86 2
            $sheet->getStyle('A1:' . $letteracolonna . '1')->applyFromArray($style_header);
87
        }
88
89 2
        $sheet->getRowDimension('1')->setRowHeight(20);
90 2
    }
91 2
    private function printBodyXls($header, $rows, $sheet)
92
    {
93 2
        $row = 2;
94 2
        foreach ($rows as $riga) {
95 2
            $col = 1;
96 2
            foreach ($header as $colonnatestata => $valorecolonnatestata) {
97 2
                if ($valorecolonnatestata["escluso"] === false) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal escluso does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
98 2
                    $dfr = new DoctrineFieldReader($riga);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
99 2
                    $oggetto = $dfr->getField2Object($colonnatestata, $riga);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
100 2
                    $valorecampo = $dfr->object2view($oggetto, $valorecolonnatestata["tipocampo"]);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal tipocampo does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
101 2
                    if ($valorecampo === '' || $valorecampo === null) {
102 2
                        $col = $col + 1;
0 ignored issues
show
Coding Style introduced by
Increment operators should be used where possible; found "$col = $col + 1;" but expected "$col++"
Loading history...
103 2
                        continue;
104
                    }
105 2
                    $sheet->setCellValueByColumnAndRow($col, $row, $this->getValueCell($valorecolonnatestata["tipocampo"], $valorecampo));
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal tipocampo does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
106 2
                    $col = $col + 1;
0 ignored issues
show
Coding Style introduced by
Increment operators should be used where possible; found "$col = $col + 1;" but expected "$col++"
Loading history...
107
                }
108
            }
109 2
            $sheet->getRowDimension($row)->setRowHeight(18);
110 2
            ++$row;
111
        }
112
113 2
        $col = 1;
114
        //Si impostano i formati cella in base al tipo di dato contenuto
115 2
        foreach ($header as $colonnatestata => $valorecolonnatestata) {
116 2
            if ($valorecolonnatestata["escluso"] === false) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal escluso does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
117 2
                $this->setCellFormat($sheet, $col, $row - 1, $valorecolonnatestata["tipocampo"]);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal tipocampo does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
118 2
                $col = $col + 1;
0 ignored issues
show
Coding Style introduced by
Increment operators should be used where possible; found "$col = $col + 1;" but expected "$col++"
Loading history...
119
            }
120
        }
121 2
    }
122 2
    private function getValueCell($tipocampo, $valorecella)
123
    {
124 2
        $valore = null;
125 2
        switch ($tipocampo) {
126 2
            case 'date':
127 1
                $d = (int) substr($valorecella, 0, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
128 1
                $m = (int) substr($valorecella, 3, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
129 1
                $y = (int) substr($valorecella, 6, 4);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
130 1
                $t_date = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($y, $m, $d);
131 1
                $valore = $t_date;
132 1
                break;
133 2
            case 'datetime':
134 1
                $d = (int) substr($valorecella, 0, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
135 1
                $m = (int) substr($valorecella, 3, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
136 1
                $y = (int) substr($valorecella, 6, 4);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
137 1
                $h = (int) substr($valorecella, 11, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
138 1
                $i = (int) substr($valorecella, 14, 2);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
139 1
                $t_date = \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($y, $m, $d, $h, $i, 0);
140 1
                $valore = $t_date;
141 1
                break;
142
            default:
143 2
                $valore = $valorecella;
144 2
                break;
145
        }
146 2
        return $valore;
147
    }
148 2
    private function setCellFormat($sheet, $indicecolonna, $lastrow, $tipocampo)
149
    {
150 2
        $letteracolonna = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($indicecolonna);
151 2
        switch ($tipocampo) {
152 2
            case 'text':
153 1
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
154 1
                        ->getNumberFormat()
155 1
                        ->setFormatCode("@");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal @ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
156 1
                break;
157 2
            case 'string':
158 2
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
159 2
                        ->getNumberFormat()
160 2
                        ->setFormatCode("@");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal @ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
161 2
                break;
162 2
            case 'integer':
163 2
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
164 2
                        ->getNumberFormat()
165 2
                        ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER);
166 2
                break;
167 2
            case 'float':
168
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
169
                        ->getNumberFormat()
170
                        ->setFormatCode('#,##0.00');
171
                break;
172 2
            case 'decimal':
173 1
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
174 1
                        ->getNumberFormat()
175 1
                        ->setFormatCode('#,##0.00');
176 1
                break;
177 2
            case 'number':
178
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
179
                        ->getNumberFormat()
180
                        ->setFormatCode('#,##0.00');
181
                break;
182 2
            case 'datetime':
183
                //\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYYSLASH
184 1
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
185 1
                        ->getNumberFormat()
186 1
                        ->setFormatCode("dd/mm/yyyy hh:mm:ss");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal dd/mm/yyyy hh:mm:ss does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
187 1
                break;
188 2
            case 'date':
189 1
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
190 1
                        ->getNumberFormat()
191 1
                        ->setFormatCode("dd/mm/yyyy");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal dd/mm/yyyy does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
192 1
                break;
193
            default:
194 2
                $sheet->getStyle($letteracolonna . '2:' . $letteracolonna . $lastrow)
195 2
                        ->getNumberFormat()
196 2
                        ->setFormatCode("@");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal @ does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
197 2
                break;
198
        }
199 2
    }
200
}
201