Passed
Push — master ( a357e7...195a07 )
by Anton
04:22 queued 01:11
created

Extension::init()   C

Complexity

Conditions 8
Paths 13

Size

Total Lines 22
Code Lines 10

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 22
rs 6.6037
cc 8
eloc 10
nc 13
nop 1
1
<?php
2
3
namespace Modules\Extend\Utils {
4
5
	abstract class Extension {
6
7
		protected static $loader = null;
8
9
		# Check if name valid
10
11
		public static function valid(string $name) {
12
13
			return (preg_match(static::$regex_name, $name) ? true : false);
14
		}
15
16
		# Validate name
17
18
		public static function validate(string $name) {
19
20
			return (preg_match(static::$regex_name, $name) ? $name : false);
21
		}
22
23
		# Static overloader
24
25
		public static function __callStatic($name, $arguments) {
26
27
			if (null !== static::$loader) return static::$loader->$name(...$arguments);
28
		}
29
	}
30
}
31