Completed
Push — 0.2.1 ( e70612...dab97b )
by Anton
04:42
created

Variables   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 33
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addItem() 0 4 1
A __construct() 0 12 4
A items() 0 4 1
1
<?php
2
3
namespace Utils\Template {
4
5
	use DB;
6
7
	class Variables {
8
9
		private $items = [];
10
11
		# Add item
12
13
		private function addItem(string $name, string $value) {
14
15
			$this->items[$name] = $value;
16
		}
17
18
		# Constructor
19
20
		public function __construct() {
21
22
			# Process selection
23
24
			$selection = ['name', 'value']; $order = ['name' => 'ASC'];
25
26
			if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::last()->status)) return;
27
28
			# Process results
29
30
			while (null !== ($variable = DB::last()->row())) $this->addItem($variable['name'], $variable['value']);
31
		}
32
33
		# Return items
34
35
		public function items() {
36
37
			return $this->items;
38
		}
39
	}
40
}
41