Select   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 108
Duplicated Lines 10.19 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 11
loc 108
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 11 11 1
A getForeignTable() 0 4 1
A getForeignTableWhere() 0 4 1
A getItems() 0 4 1
A getMaxItems() 0 4 1
A getMinItems() 0 4 1
A getSize() 0 4 1
A getForeignField() 0 4 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 TildBJ\Seeder\Domain\Model\Column;
3
4
/***************************************************************
5
 *
6
 *  Copyright notice
7
 *
8
 *  (c) 2016 Dennis Römmich <[email protected]>
9
 *
10
 *  All rights reserved
11
 *
12
 *  This script is part of the TYPO3 project. The TYPO3 project is
13
 *  free software; you can redistribute it and/or modify
14
 *  it under the terms of the GNU General Public License as published by
15
 *  the Free Software Foundation; either version 3 of the License, or
16
 *  (at your option) any later version.
17
 *
18
 *  The GNU General Public License can be found at
19
 *  http://www.gnu.org/copyleft/gpl.html.
20
 *
21
 *  This script is distributed in the hope that it will be useful,
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 *  GNU General Public License for more details.
25
 *
26
 *  This copyright notice MUST APPEAR in all copies of the script!
27
 ***************************************************************/
28
use TildBJ\Seeder\Domain\Model\Column;
29
30
/**
31
 * Class Select
32
 *
33
 * @package TildBJ\Seeder\Domain\Model\Group
34
 */
35
class Select extends Column implements SelectInterface
36
{
37
    /**
38
     * @return string
39
     */
40
    protected $foreignTable;
41
42
    /**
43
     * @return string
44
     */
45
    protected $foreignTableWhere;
46
47
    /**
48
     * @return array
49
     */
50
    protected $items;
51
52
    /**
53
     * @return int
54
     */
55
    protected $maxItems;
56
57
    /**
58
     * @return int
59
     */
60
    protected $minItems;
61
62
    /**
63
     * @return int
64
     */
65
    protected $size;
66
67
    /*
68
     * @var string
69
     */
70
    protected $foreignField;
71
72
    /**
73
     * Input constructor.
74
     *
75
     * @param string $columnName
76
     * @param $configuration
77
     */
78 View Code Duplication
    public function __construct($columnName, $configuration)
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...
79
    {
80
        parent::__construct($columnName);
81
        $this->foreignTable = $configuration['foreign_table'];
82
        $this->foreignField = $configuration['foreign_field'];
83
        $this->foreignTableWhere = $configuration['foreign_table_where'];
84
        $this->items = $configuration['items'];
85
        $this->maxItems = $configuration['maxitems'];
86
        $this->minItems = $configuration['minitems'];
87
        $this->size = $configuration['size'];
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getForeignTable()
94
    {
95
        return $this->foreignTable;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getForeignTableWhere()
102
    {
103
        return $this->foreignTableWhere;
104
    }
105
106
    /**
107
     * @return array
108
     */
109
    public function getItems()
110
    {
111
        return $this->items;
112
    }
113
114
    /**
115
     * @return int
116
     */
117
    public function getMaxItems()
118
    {
119
        return $this->maxItems;
120
    }
121
122
    /**
123
     * @return int
124
     */
125
    public function getMinItems()
126
    {
127
        return $this->minItems;
128
    }
129
130
    /**
131
     * @return int
132
     */
133
    public function getSize()
134
    {
135
        return $this->size;
136
    }
137
138
    public function getForeignField()
139
    {
140
        return $this->foreignField;
141
    }
142
}
143