Passed
Pull Request — master (#11)
by Anton
03:24
created

Schema::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Utils {
4
5
	abstract class Schema {
6
7
		private static $cache = [];
8
9
		# Get schema
10
11
		public static function get(string $name) {
12
13
			$class_name = ('Schemas\\' . $name);
14
15
			if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name;
16
17
			# ------------------------
18
19
			return self::$cache[$class_name];
20
		}
21
	}
22
}
23