Completed
Pull Request — master (#15)
by Gabriel
03:36
created

CollectionCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 40.74 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 0
cbo 4
dl 11
loc 27
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 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
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license. For more information, see
17
 * <http://www.doctrine-project.org>.
18
 */
19
20
namespace Baleen\Migrations\Service\Command\Migrate\Collection;
21
22
use Baleen\Migrations\Migration\Options;
23
use Baleen\Migrations\Migration\OptionsInterface;
24
use Baleen\Migrations\Service\Command\DomainCommandInterface;
25
use Baleen\Migrations\Service\Command\HasCollectionTrait;
26
use Baleen\Migrations\Service\Command\HasOptionsTrait;
27
use Baleen\Migrations\Service\Command\HasVersionRepositoryTrait;
28
use Baleen\Migrations\Service\Command\Migrate\AbstractMigrateCommand;
29
use Baleen\Migrations\Service\Command\Migrate\HasTargetTrait;
30
use Baleen\Migrations\Shared\Collection\CollectionInterface;
31
use Baleen\Migrations\Version\Repository\VersionRepositoryInterface;
32
use Baleen\Migrations\Version\VersionInterface;
33
34
/**
35
 * Class CollectionCommand
36
 * @author Gabriel Somoza <[email protected]>
37
 */
38
final class CollectionCommand implements DomainCommandInterface
39
{
40
    use HasCollectionTrait;
41
    use HasTargetTrait;
42
    use HasOptionsTrait;
43
    use HasVersionRepositoryTrait;
44
45
    /**
46
     * CollectionCommand constructor.
47
     *
48
     * @param CollectionInterface $collection
49
     * @param VersionInterface $target
50
     * @param OptionsInterface $options
51
     * @param VersionRepositoryInterface $versionRepository
52
     */
53 10 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method 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...
54
        CollectionInterface $collection,
55
        VersionInterface $target,
56
        OptionsInterface $options,
57
        VersionRepositoryInterface $versionRepository
58
    ) {
59 10
        $this->setCollection($collection);
60 10
        $this->setTarget($target);
61 10
        $this->setOptions($options);
62 10
        $this->setVersionRepository($versionRepository);
63 10
    }
64
}
65