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

Indexes::add()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 3
eloc 3
nc 2
nop 2
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