SitemapCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Command;
4
5
use Alpixel\Bundle\CronBundle\Annotation\CronJob;
6
use Presta\SitemapBundle\Command\DumpSitemapsCommand;
7
use Symfony\Component\Console\Input\ArgvInput;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
11
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
12
13
/**
14
 * @author Benjamin HUBERT <[email protected]>
15
 * @CronJob("P1D", startTime="today 1:00")
16
 */
17
class SitemapCommand extends DumpSitemapsCommand implements ContainerAwareInterface
18
{
19
    use ContainerAwareTrait;
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function configure()
25
    {
26
        parent::configure();
27
        $this->setName('alpixel:cms:sitemap');
28
        $this->setDescription('Alias of the presta:sitemaps:dump used for cronjobs');
29
    }
30
31
    public function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        $definition = $this->getDefinition();
34
        $arguments = $definition->getArguments();
35
        $arguments['target']->setDefault($this->container->getParameter('kernel.root_dir').'/../web/');
0 ignored issues
show
Bug introduced by
The property container cannot be accessed from this context as it is declared private in class Symfony\Bundle\Framework...d\ContainerAwareCommand.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
36
        $definition->setArguments($arguments);
37
38
        if (count($input->getArguments()) === 0) {
39
            $input = new ArgvInput(null, $definition);
40
            $input->setArgument('target', $this->container->getParameter('kernel.root_dir').'/../web/');
0 ignored issues
show
Bug introduced by
The property container cannot be accessed from this context as it is declared private in class Symfony\Bundle\Framework...d\ContainerAwareCommand.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
41
        }
42
43
        return parent::execute($input, $output);
44
    }
45
}
46