SyncFSCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 2
c 4
b 0
f 0
lcom 0
cbo 6
dl 0
loc 41
ccs 16
cts 16
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 17 1
1
<?php
2
3
namespace Velikonja\LabbyBundle\Command;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use Symfony\Component\Stopwatch\Stopwatch;
8
9
class SyncFSCommand extends BaseCommand
10
{
11
    const COMMAND_NAME = 'labby:sync:fs';
12
13
    /**
14
     * Configure command.
15
     */
16 10
    protected function configure()
17
    {
18
        $this
19 10
            ->setRoles(array(self::ROLE_LOCAL))
20 10
            ->setName(self::COMMAND_NAME)
21 10
            ->setDescription('Run synchronization of filesystem maps.');
22 10
    }
23
24
    /**
25
     * @param InputInterface  $input
26
     * @param OutputInterface $output
27
     *
28
     * @throws \Exception
29
     *
30
     * @return int|null|void
31
     */
32 1
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34 1
        $syncer    = $this->getContainer()->get('velikonja_labby.service.syncer');
35 1
        $stopwatch = new Stopwatch();
36
37 1
        $stopwatch->start('sync_fs');
38 1
        $syncer->syncFs($output);
39 1
        $event = $stopwatch->stop('sync_fs');
40
41 1
        $output->writeln('');
42 1
        $output->writeln(
43
            sprintf(
44 1
                '<info>Finished in %.2f seconds!</info>',
45 1
                $event->getDuration() / 1000
46
            )
47
        );
48 1
    }
49
}
50