UpdateCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 28
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 7 7 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
namespace Magestead\Command;
3
4
use Symfony\Component\Console\Command\Command;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Class UpdateCommand
10
 * @package Magestead\Command
11
 */
12 View Code Duplication
class UpdateCommand extends Command
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...
13
{
14
    private $projectPath;
15
16
    /**
17
     * Configure the command and description
18
     */
19
    public function configure()
20
    {
21
        $this->projectPath = getcwd();
22
23
        $this->setName("self-update");
24
        $this->setDescription("Check for new updates for Magestead CLI");
25
    }
26
27
    /**
28
     * Execute a global composer update for the package
29
     *
30
     * @param InputInterface $input
31
     * @param OutputInterface $output
32
     * @return ProcessCommand
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $output->writeln('<info>Checking for Updates</info>');
37
        return new ProcessCommand('composer global update richdynamix/magestead', $this->projectPath, $output);
38
    }
39
}