Passed
Branch 0.3.0 (b16461)
by Anton
03:34
created

Indexes   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A add() 0 6 3
1
<?php
2
3
namespace Modules\Entitizer\Utils\Definition\Group {
4
5
	use Modules\Entitizer\Utils\Definition;
6
7
	class Indexes extends Definition\Group {
8
9
		# Constructor
10
11
		public function __construct(Definition $definition) {
12
13
			parent::__construct($definition);
14
15
			$this->list['id'] = new Definition\Item\Index('id', 'PRIMARY');
16
		}
17
18
		# Add index
19
20
		public function add(string $name, string $type = null) {
21
22
			if (!isset($this->definition->params()[$name]) || isset($this->list[$name])) return;
23
24
			$this->list[$name] = new Definition\Item\Index($name, $type);
25
		}
26
	}
27
}
28