UpdateCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
namespace Browscap\BrowscapBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class UpdateCommand extends ContainerAwareCommand
10
{
11
    protected function configure()
12
    {
13
        $this
14
            ->setName('browscap:update')
15
            ->setDescription('Update Browscap cache')
16
        ;
17
    }
18
19
    protected function execute(InputInterface $input, OutputInterface $output)
20
    {
21
        if( $this->getContainer()->get('browscap')->updateCache() ) {
22
23
            $output->writeln('The cache has been updated successfully');
24
            return;
25
        }
26
        $output->writeln('An error occurred during cache update');
27
    }
28
}
29