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

Variables::items()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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