Completed
Pull Request — master (#4)
by Timothy
14:57
created

CheckMigrationsUpToDateFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 5
dl 22
loc 22
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 11 11 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
namespace Abacaphiliac\DoctrineORMDiagnosticsModule\CheckMigrations;
4
5
use Abacaphiliac\DoctrineORMDiagnosticsModule\CheckCommand;
6
use Doctrine\DBAL\Migrations\Tools\Console\Command\UpToDateCommand;
7
use DoctrineModule\Component\Console\Input\RequestInput;
8
use DoctrineModule\Component\Console\Output\PropertyOutput;
9
use Zend\Console\Request;
10
use Zend\ServiceManager\FactoryInterface;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
13 View Code Duplication
class CheckMigrationsUpToDateFactory implements FactoryInterface
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...
14
{
15
    /**
16
     * Create service
17
     *
18
     * @param ServiceLocatorInterface $serviceLocator
19
     * @return mixed
20
     * @throws \Zend\Console\Exception\RuntimeException
21
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
22
     */
23 2
    public function createService(ServiceLocatorInterface $serviceLocator)
24
    {
25
        /** @var UpToDateCommand $command */
26 2
        $command = $serviceLocator->get('doctrine.migrations_cmd.uptodate');
27
28 2
        $input = new RequestInput(new Request(array()));
29
30 2
        $output = new PropertyOutput();
31
32 2
        return new CheckCommand($command, $input, $output);
33
    }
34
}
35