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

Schema   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 10 2
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