Completed
Pull Request — master (#3)
by nicolas
03:49
created

PathLoggedForResourceCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 12 2
1
<?php
2
3
namespace Dekalee\Cdn77Bundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * Class PathLoggedForResourceCommand
13
 */
14
class PathLoggedForResourceCommand extends ContainerAwareCommand
15
{
16
    /**
17
     * Configure the command
18
     */
19
    protected function configure()
20
    {
21
        $this
22
            ->setName('dekalee:cdn77:path-logged-for-resource')
23
            ->setDescription('Get all the path stored in the log for a resource')
24
            ->addOption('resource', null, InputOption::VALUE_REQUIRED, 'The resource to get the log from')
25
        ;
26
    }
27
28
    /**
29
     * @param InputInterface  $input
30
     * @param OutputInterface $output
31
     *
32
     * @return int|null|void
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $ressource = $input->getOption('resource');
37
38
        $logs = $this->getContainer()->get('dekalee_cdn77.query.resource_log')->execute($ressource);
39
40
        $output->writeln('List of file in the log');
41
42
        foreach ($logs as $log) {
43
            $output->writeln($log['path']);
44
        }
45
    }
46
}
47