SyncFSCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 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