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

JournaldPostfixLogsCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 8 8 1
A execute() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/***************************************************************************
3
 * For license information see LICENSE.md
4
 ***************************************************************************/
5
6
namespace Oc\Command;
7
8
use Oc\Postfix\JournalLogs;
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 JournaldPostfixLogsCommand
16
 *
17
 * @package Oc\Command
18
 */
19 View Code Duplication
class JournaldPostfixLogsCommand extends ContainerAwareCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
{
21
    const COMMAND_NAME = 'postfix:processing-logs';
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('process postfix logs for support');
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
        $journal = $this->getContainer()->get(JournalLogs::class);
50
        $journal->processJournalLogs();
51
    }
52
}
53