Completed
Branch 0.2.1 (e70612)
by Anton
09:15
created

Param   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 41
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 4 1
A index() 0 4 1
A unique() 0 4 1
A primary() 0 4 1
A keyStatement() 0 6 4
1
<?php
2
3
namespace Modules\Entitizer\Utils {
4
5
	abstract class Param {
6
7
		protected $name = '', $index = false, $unique = false, $primary = false;
8
9
		# Return name
10
11
		public function name() {
12
13
			return $this->name;
14
		}
15
16
		# Check if param is index
17
18
		public function index() {
19
20
			return $this->index;
21
		}
22
23
		# Check if param is unique
24
25
		public function unique() {
26
27
			return $this->unique;
28
		}
29
30
		# Check if param is primary
31
32
		public function primary() {
33
34
			return $this->primary;
35
		}
36
37
		# Get key statement
38
39
		public function keyStatement() {
40
41
			return ($this->index ? (($this->unique ? ($this->primary ? "PRIMARY " : "UNIQUE ") : "") .
42
43
			       ("KEY `" . $this->name . "` (`" . $this->name . "`)")) : false);
44
		}
45
	}
46
}
47