Passed
Pull Request — development (#671)
by Nick
06:47
created

OkapiCronjobsCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 6 1
1
<?php
2
/***************************************************************************
3
 * For license information see LICENSE.md
4
 ***************************************************************************/
5
6
namespace Oc\Command;
7
8
use okapi\core\Okapi;
9
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
10
use Symfony\Component\Console\Exception\InvalidArgumentException;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
/**
15
 * Class OkapiCronjobsCommand
16
 *
17
 * @package Oc\Command
18
 */
19
class OkapiCronjobsCommand extends ContainerAwareCommand
20
{
21
    const COMMAND_NAME = 'okapi:cronjobs';
22
23
    /**
24
     * Configures the command.
25
     *
26
     * @return void
27
     *
28
     * @throws InvalidArgumentException
29
     */
30
    protected function configure()
31
    {
32
        parent::configure();
33
34
        $this
35
            ->setName(self::COMMAND_NAME)
36
            ->setDescription('executes okapi5 cronjobs');
37
    }
38
39
    /**
40
     * Executes the command.
41
     *
42
     * @param InputInterface $input
43
     * @param OutputInterface $output
44
     *
45
     * @return int|null
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        require_once __DIR__.'/../../../okapi/autoload.php';
50
        Okapi::execute_prerequest_cronjobs();
51
        Okapi::execute_cron5_cronjobs();
52
    }
53
}
54