DayReport::printData()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
ccs 0
cts 23
cp 0
rs 8.8571
cc 1
eloc 20
nc 1
nop 1
crap 2
1
<?php
2
3
namespace AppBundle\Action\Executor;
4
5
use AppBundle\Entity\Action;
6
use AppBundle\Entity\VarHook;
7
use AppBundle\Entity\Variable;
8
9
class DayReport extends BaseExecutor implements ExecutorInterface
10
{
11
    public function printData(Action $action)
0 ignored issues
show
Unused Code introduced by
The parameter $action is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        $varService = $this->getContainer()->get('vars');
14
15
        $this->getContainer()->get('logger')->addInfo('Getting report data');
16
17
        $title = [
18
        'Утренний отчет'."\n",
19
        (new \DateTime())->format('Y-m-d H:i:s')
20
        ];
21
22
        $temp = $varService->get('inside.temperature');
23
        $tempInside = $varService->getExtremes($temp);
0 ignored issues
show
Unused Code introduced by
$tempInside is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
24
25
        $temp = $varService->get('outside.temperature');
26
        $tempOutside = $varService->getExtremes($temp);
0 ignored issues
show
Unused Code introduced by
$tempOutside is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
27
28
        $temp = $varService->get('inside.pressure');
29
        $pressureInside = $varService->getExtremes($temp);
0 ignored issues
show
Unused Code introduced by
$pressureInside is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
30
31
        $thermal = $this->getContainer()->get('thermal');
32
33
        $thermal->
34
        hhr()
35
            ->writeText($title[0])
36
            ->writeText($title[1])
37
            ->hhr()
38
            ->writeText('Themperature')
39
            ->hhr();
40
    }
41
}
42