Completed
Push — master ( ea3c7e...ca6541 )
by Kirill
04:42
created

UpdateDisplayCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 29
ccs 18
cts 18
cp 1
rs 10
c 1
b 1
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 18 1
1
<?php
2
3
namespace AppBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class UpdateDisplayCommand extends ContainerAwareCommand
11
{
12 2
    protected function configure()
13
    {
14
        $this
15 2
            ->setName('home:updatedisplay')
16 2
            ->setDescription('Updates LCD with var data.')
17 2
            ->setHelp("This command updates display. Can be run every second");
18 2
    }
19
20 1
    protected function execute(InputInterface $input, OutputInterface $output)
21
    {
22
        
23 1
        $lines = [];
24
        
25 1
        $varService = $this->getContainer()->get('vars');
26
        
27 1
        $lines[0] = "[Internet]   [".date('H:i').']';
28 1
        $lines[1] = "Ping:    ".$varService->get('internet.ping')->getValue()."   ms";
29 1
        $lines[2] = "Upload:  ".(round($varService->get('internet.upload')->getValue()/10000)/100)."   mbps";
30 1
        $lines[3] = "Dload:   ".(round($varService->get('internet.download')->getValue()/10000)/100)."  mbps";
31
32 1
        exec('/usr/bin/python '.__DIR__.'/../../../bin/lcd_i2c.py "'.
33 1
            $lines[0].'" "'.
34 1
            $lines[1].'" "'.
35 1
            $lines[2].'" "'.
36 1
            $lines[3].'"');
37 1
    }
38
}
39