Passed
Push — master ( a8e014...32f983 )
by Andrea
53:55
created

StampatabellaController::printBodyXls()   C

Complexity

Conditions 13
Paths 36

Size

Total Lines 66
Code Lines 58

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 50
CRAP Score 14.2244

Importance

Changes 0
Metric Value
dl 0
loc 66
ccs 50
cts 62
cp 0.8065
rs 5.8968
c 0
b 0
f 0
cc 13
eloc 58
nc 36
nop 3
crap 14.2244

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Fi\CoreBundle\Controller;
4
5
class StampatabellaController extends FiCoreController
6
{
7
    public function __construct($container = null)
8
    {
9
        if ($container) {
10
            $this->setContainer($container);
11
        }
12
    }
13
    public function stampa($parametri = array())
14
    {
15
        $stampaservice = $this->get("ficorebundle.tabelle.stampa.pdf");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal ficorebundle.tabelle.stampa.pdf 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...
16
        return $stampaservice->stampa($parametri);
17
    }
18
    public function esportaexcel($parametri = array())
19
    {
20
        $stampaservice = $this->get("ficorebundle.tabelle.stampa.xls");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal ficorebundle.tabelle.stampa.xls 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...
21
        return $stampaservice->esportaexcel($parametri);
22
    }
23
}
24