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
/**
15
* @var Index[] Table indices
16
*/
17
protected $collection = [];
18
19
/**
20
* Add index to collection
21
*
22
* @param Index $index
23
*
24
* @throws \InvalidArgumentException if incorrect object type is added
25
*/
26
2
public function add($index) {
27
2
if (!is_object($index) || get_class($index) !== 'Zortje\MySQLKeeper\Database\Table\Index') {
throw new \InvalidArgumentException(sprintf('Collection may only contain "%s" objects, "%s" is not allowed', 'Zortje\MySQLKeeper\Database\Table\Index', $argumentType));
31
}
32
33
1
$this->collection[] = $index;
34
1
}
35
36
/**
37
* Get index collection with non primary key indices
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.